History

Merge pull request #1457 from ruil2/enc_cabac

add encoder cabac support

sijchen committed 12 years ago

Commit 292d2512 parents 5cefad2 abc01e638 files · +2072 −273Browse files

Unified · Split

38 files
  1. codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj +16 −0
  2. codec/build/win32/enc/WelsEncCore.vcproj +88 −68
  3. codec/console/enc/src/welsenc.cpp +6 −0
  4. codec/encoder/core/inc/au_set.h +2 −1
  5. codec/encoder/core/inc/encoder.h +1 −1
  6. codec/encoder/core/inc/encoder_context.h +1 −1
  7. codec/encoder/core/inc/param_svc.h +6 −5
  8. codec/encoder/core/inc/parameter_sets.h +1 −1
  9. codec/encoder/core/inc/set_mb_syn_cabac.h +89 −0
  10. codec/encoder/core/inc/set_mb_syn_cavlc.h +11 −11
  11. codec/encoder/core/inc/slice.h +5 −1
  12. codec/encoder/core/inc/svc_enc_golomb.h +10 −1
  13. codec/encoder/core/inc/svc_enc_macroblock.h +4 −0
  14. codec/encoder/core/inc/svc_enc_slice_segment.h +4 −1
  15. codec/encoder/core/inc/svc_set_mb_syn.h +68 −0
  16. codec/encoder/core/inc/svc_set_mb_syn_cavlc.h +8 −4
  17. codec/encoder/core/inc/wels_common_basis.h +48 −43
  18. codec/encoder/core/inc/wels_func_ptr_def.h +10 −3
  19. codec/encoder/core/src/au_set.cpp +4 −2
  20. codec/encoder/core/src/cabac.cpp +557 −0
  21. codec/encoder/core/src/encoder.cpp +3 −2
  22. codec/encoder/core/src/encoder_ext.cpp +5 −2
  23. codec/encoder/core/src/set_mb_syn_cabac.cpp +240 −0
  24. codec/encoder/core/src/set_mb_syn_cavlc.cpp +52 −2
  25. codec/encoder/core/src/svc_base_layer_md.cpp +2 −1
  26. codec/encoder/core/src/svc_encode_slice.cpp +57 −64
  27. codec/encoder/core/src/svc_set_mb_syn_cabac.cpp +691 −0
  28. codec/encoder/core/src/svc_set_mb_syn_cavlc.cpp +41 −27
  29. codec/encoder/targets.mk +3 −0
  30. test/BaseEncoderTest.h +2 −2
  31. test/api/BaseEncoderTest.cpp +7 −8
  32. test/api/decode_encode_test.cpp +1 −2
  33. test/api/encoder_test.cpp +24 −15
  34. testbin/welsenc.cfg +1 −1
  35. testbin/welsenc_arbitrary_res.cfg +1 −1
  36. testbin/welsenc_ios.cfg +1 −1
  37. testbin/welsenc_vd_1d.cfg +1 −1
  38. testbin/welsenc_vd_rc.cfg +1 −1
codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj+16−0
@@ -51,6 +51,9 @@ · 50 unmodified lines
5151 9AED66661946A2B3009A3567 /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AED66651946A2B3009A3567 /* utils.cpp */; };
5252 F5617A50196A833A006E2B20 /* reconstruct_aarch64_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = F5617A4F196A833A006E2B20 /* reconstruct_aarch64_neon.S */; };
5353 F5BE8005196B913200ED02ED /* memory_aarch64_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = F5BE8004196B913200ED02ED /* memory_aarch64_neon.S */; };
54+ F7E9994519EBD1E9009B1021 /* svc_set_mb_syn_cabac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7E9994419EBD1E9009B1021 /* svc_set_mb_syn_cabac.cpp */; };
55+ F7E9994719EBD1EF009B1021 /* cabac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7E9994619EBD1EF009B1021 /* cabac.cpp */; };
56+ F7E9994919EBD1F8009B1021 /* set_mb_syn_cabac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7E9994819EBD1F8009B1021 /* set_mb_syn_cabac.cpp */; };
5457 /* End PBXBuildFile section */
5558
5659 /* Begin PBXCopyFilesBuildPhase section */
@@ -164,6 +167,11 @@ · 107 unmodified lines
164167 9AED66671946A2C4009A3567 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../../common/inc/utils.h; sourceTree = "<group>"; };
165168 F5617A4F196A833A006E2B20 /* reconstruct_aarch64_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = reconstruct_aarch64_neon.S; path = arm64/reconstruct_aarch64_neon.S; sourceTree = "<group>"; };
166169 F5BE8004196B913200ED02ED /* memory_aarch64_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = memory_aarch64_neon.S; path = arm64/memory_aarch64_neon.S; sourceTree = "<group>"; };
170+ F7E9994419EBD1E9009B1021 /* svc_set_mb_syn_cabac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = svc_set_mb_syn_cabac.cpp; sourceTree = "<group>"; };
171+ F7E9994619EBD1EF009B1021 /* cabac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cabac.cpp; sourceTree = "<group>"; };
172+ F7E9994819EBD1F8009B1021 /* set_mb_syn_cabac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = set_mb_syn_cabac.cpp; sourceTree = "<group>"; };
173+ F7E9997E19EBD3C6009B1021 /* set_mb_syn_cabac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = set_mb_syn_cabac.h; sourceTree = "<group>"; };
174+ F7E9997F19EBD3CE009B1021 /* svc_set_mb_syn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svc_set_mb_syn.h; sourceTree = "<group>"; };
167175 /* End PBXFileReference section */
168176
169177 /* Begin PBXFrameworksBuildPhase section */
@@ -254,6 +262,8 @@ · 84 unmodified lines
254262 4CE446A918BC605C0017DF25 /* inc */ = {
255263 isa = PBXGroup;
256264 children = (
265+ F7E9997F19EBD3CE009B1021 /* svc_set_mb_syn.h */,
266+ F7E9997E19EBD3C6009B1021 /* set_mb_syn_cabac.h */,
257267 9AED66671946A2C4009A3567 /* utils.h */,
258268 4CDBFB9D18E5068D0025A767 /* wels_transpose_matrix.h */,
259269 4CE446AA18BC605C0017DF25 /* as264_common.h */,
@@ -309,6 +319,9 @@ · 49 unmodified lines
309319 4CE446DC18BC605C0017DF25 /* src */ = {
310320 isa = PBXGroup;
311321 children = (
322+ F7E9994819EBD1F8009B1021 /* set_mb_syn_cabac.cpp */,
323+ F7E9994619EBD1EF009B1021 /* cabac.cpp */,
324+ F7E9994419EBD1E9009B1021 /* svc_set_mb_syn_cabac.cpp */,
312325 9AED66651946A2B3009A3567 /* utils.cpp */,
313326 4CE446DD18BC605C0017DF25 /* au_set.cpp */,
314327 4CE446DE18BC605C0017DF25 /* deblocking.cpp */,
@@ -438,6 +451,7 @@ · 123 unmodified lines
438451 4C34067018C57D0400DFA14A /* memory_neon.S in Sources */,
439452 4CE4470F18BC605C0017DF25 /* deblocking.cpp in Sources */,
440453 4CE4472518BC605C0017DF25 /* svc_encode_mb.cpp in Sources */,
454+ F7E9994719EBD1EF009B1021 /* cabac.cpp in Sources */,
441455 4CE4471A18BC605C0017DF25 /* mv_pred.cpp in Sources */,
442456 4C34066E18C57D0400DFA14A /* intra_pred_sad_3_opt_neon.S in Sources */,
443457 4C23BC60195A77E0003B81FC /* intra_pred_sad_3_opt_aarch64_neon.S in Sources */,
@@ -446,6 +460,7 @@ · 2 unmodified lines
446460 F5BE8005196B913200ED02ED /* memory_aarch64_neon.S in Sources */,
447461 4CBC1B83194ACBB400214D9E /* intra_pred_aarch64_neon.S in Sources */,
448462 4CE4471718BC605C0017DF25 /* mc.cpp in Sources */,
463+ F7E9994519EBD1E9009B1021 /* svc_set_mb_syn_cabac.cpp in Sources */,
449464 F5617A50196A833A006E2B20 /* reconstruct_aarch64_neon.S in Sources */,
450465 4CE4472918BC605C0017DF25 /* svc_set_mb_syn_cavlc.cpp in Sources */,
451466 4CE4471818BC605C0017DF25 /* md.cpp in Sources */,
@@ -465,6 +480,7 @@ · 13 unmodified lines
465480 6CA38DA51991D31A003EAAE0 /* svc_motion_estimation_aarch64_neon.S in Sources */,
466481 4CE4471418BC605C0017DF25 /* encoder_ext.cpp in Sources */,
467482 4C34067218C57D0400DFA14A /* reconstruct_neon.S in Sources */,
483+ F7E9994919EBD1F8009B1021 /* set_mb_syn_cabac.cpp in Sources */,
468484 );
469485 runOnlyForDeploymentPostprocessing = 0;
470486 };
codec/build/win32/enc/WelsEncCore.vcproj+88−68
@@ -329,6 +329,10 @@ · 328 unmodified lines
329329 RelativePath="..\..\..\encoder\core\src\au_set.cpp"
330330 >
331331 </File>
332+ <File
333+ RelativePath="..\..\..\encoder\core\src\cabac.cpp"
334+ >
335+ </File>
332336 <File
333337 RelativePath="..\..\..\common\src\common_tables.cpp"
334338 >
@@ -429,6 +433,10 @@ · 94 unmodified lines
429433 RelativePath="..\..\..\encoder\core\src\sample.cpp"
430434 >
431435 </File>
436+ <File
437+ RelativePath="..\..\..\encoder\core\src\set_mb_syn_cabac.cpp"
438+ >
439+ </File>
432440 <File
433441 RelativePath="..\..\..\encoder\core\src\set_mb_syn_cavlc.cpp"
434442 >
@@ -461,6 +469,10 @@ · 26 unmodified lines
461469 RelativePath="..\..\..\encoder\core\src\svc_motion_estimate.cpp"
462470 >
463471 </File>
472+ <File
473+ RelativePath="..\..\..\encoder\core\src\svc_set_mb_syn_cabac.cpp"
474+ >
475+ </File>
464476 <File
465477 RelativePath="..\..\..\encoder\core\src\svc_set_mb_syn_cavlc.cpp"
466478 >
@@ -626,6 +638,10 @@ · 159 unmodified lines
626638 RelativePath="..\..\..\encoder\core\inc\sample.h"
627639 >
628640 </File>
641+ <File
642+ RelativePath="..\..\..\encoder\core\inc\set_mb_syn_cabac.h"
643+ >
644+ </File>
629645 <File
630646 RelativePath="..\..\..\encoder\core\inc\set_mb_syn_cavlc.h"
631647 >
@@ -678,6 +694,10 @@ · 46 unmodified lines
678694 RelativePath="..\..\..\encoder\core\inc\svc_motion_estimate.h"
679695 >
680696 </File>
697+ <File
698+ RelativePath="..\..\..\encoder\core\inc\svc_set_mb_syn.h"
699+ >
700+ </File>
681701 <File
682702 RelativePath="..\..\..\encoder\core\inc\svc_set_mb_syn_cavlc.h"
683703 >
@@ -731,7 +751,7 @@ · 47 unmodified lines
731751 >
732752 <Tool
733753 Name="VCCustomBuildTool"
734− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
754+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -o $(IntDir)\$(InputName).obj $(InputPath);"
735755 Outputs="$(IntDir)\$(InputName).obj"
736756 />
737757 </FileConfiguration>
@@ -740,7 +760,7 @@ · 2 unmodified lines
740760 >
741761 <Tool
742762 Name="VCCustomBuildTool"
743− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
763+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
744764 Outputs="$(IntDir)\$(InputName).obj"
745765 />
746766 </FileConfiguration>
@@ -749,7 +769,7 @@ · 2 unmodified lines
749769 >
750770 <Tool
751771 Name="VCCustomBuildTool"
752− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
772+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -o $(IntDir)\$(InputName).obj $(InputPath);"
753773 Outputs="$(IntDir)\$(InputName).obj"
754774 />
755775 </FileConfiguration>
@@ -758,7 +778,7 @@ · 2 unmodified lines
758778 >
759779 <Tool
760780 Name="VCCustomBuildTool"
761− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
781+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
762782 Outputs="$(IntDir)\$(InputName).obj"
763783 />
764784 </FileConfiguration>
@@ -771,7 +791,7 @@ · 6 unmodified lines
771791 >
772792 <Tool
773793 Name="VCCustomBuildTool"
774− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
794+ CommandLine="nasm -I$(InputDir) -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
775795 Outputs="$(IntDir)\$(InputName).obj"
776796 />
777797 </FileConfiguration>
@@ -780,7 +800,7 @@ · 2 unmodified lines
780800 >
781801 <Tool
782802 Name="VCCustomBuildTool"
783− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
803+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
784804 Outputs="$(IntDir)\$(InputName).obj"
785805 />
786806 </FileConfiguration>
@@ -789,7 +809,7 @@ · 2 unmodified lines
789809 >
790810 <Tool
791811 Name="VCCustomBuildTool"
792− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
812+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
793813 Outputs="$(IntDir)\$(InputName).obj"
794814 />
795815 </FileConfiguration>
@@ -798,7 +818,7 @@ · 2 unmodified lines
798818 >
799819 <Tool
800820 Name="VCCustomBuildTool"
801− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
821+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
802822 Outputs="$(IntDir)\$(InputName).obj"
803823 />
804824 </FileConfiguration>
@@ -811,7 +831,7 @@ · 6 unmodified lines
811831 >
812832 <Tool
813833 Name="VCCustomBuildTool"
814− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
834+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
815835 Outputs="$(IntDir)\$(InputName).obj"
816836 />
817837 </FileConfiguration>
@@ -820,7 +840,7 @@ · 2 unmodified lines
820840 >
821841 <Tool
822842 Name="VCCustomBuildTool"
823− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
843+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
824844 Outputs="$(IntDir)\$(InputName).obj"
825845 />
826846 </FileConfiguration>
@@ -829,7 +849,7 @@ · 2 unmodified lines
829849 >
830850 <Tool
831851 Name="VCCustomBuildTool"
832− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
852+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
833853 Outputs="$(IntDir)\$(InputName).obj"
834854 />
835855 </FileConfiguration>
@@ -838,7 +858,7 @@ · 2 unmodified lines
838858 >
839859 <Tool
840860 Name="VCCustomBuildTool"
841− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
861+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
842862 Outputs="$(IntDir)\$(InputName).obj"
843863 />
844864 </FileConfiguration>
@@ -851,7 +871,7 @@ · 6 unmodified lines
851871 >
852872 <Tool
853873 Name="VCCustomBuildTool"
854− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
874+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
855875 Outputs="$(IntDir)\$(InputName).obj"
856876 />
857877 </FileConfiguration>
@@ -860,7 +880,7 @@ · 2 unmodified lines
860880 >
861881 <Tool
862882 Name="VCCustomBuildTool"
863− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
883+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
864884 Outputs="$(IntDir)\$(InputName).obj"
865885 />
866886 </FileConfiguration>
@@ -869,7 +889,7 @@ · 2 unmodified lines
869889 >
870890 <Tool
871891 Name="VCCustomBuildTool"
872− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
892+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
873893 Outputs="$(IntDir)\$(InputName).obj"
874894 />
875895 </FileConfiguration>
@@ -878,7 +898,7 @@ · 2 unmodified lines
878898 >
879899 <Tool
880900 Name="VCCustomBuildTool"
881− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
901+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
882902 Outputs="$(IntDir)\$(InputName).obj"
883903 />
884904 </FileConfiguration>
@@ -891,7 +911,7 @@ · 6 unmodified lines
891911 >
892912 <Tool
893913 Name="VCCustomBuildTool"
894− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
914+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
895915 Outputs="$(IntDir)\$(InputName).obj"
896916 />
897917 </FileConfiguration>
@@ -900,7 +920,7 @@ · 2 unmodified lines
900920 >
901921 <Tool
902922 Name="VCCustomBuildTool"
903− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
923+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
904924 Outputs="$(IntDir)\$(InputName).obj"
905925 />
906926 </FileConfiguration>
@@ -909,7 +929,7 @@ · 2 unmodified lines
909929 >
910930 <Tool
911931 Name="VCCustomBuildTool"
912− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
932+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
913933 Outputs="$(IntDir)\$(InputName).obj"
914934 />
915935 </FileConfiguration>
@@ -918,7 +938,7 @@ · 2 unmodified lines
918938 >
919939 <Tool
920940 Name="VCCustomBuildTool"
921− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
941+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
922942 Outputs="$(IntDir)\$(InputName).obj"
923943 />
924944 </FileConfiguration>
@@ -931,7 +951,7 @@ · 6 unmodified lines
931951 >
932952 <Tool
933953 Name="VCCustomBuildTool"
934− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
954+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
935955 Outputs="$(IntDir)\$(InputName).obj"
936956 />
937957 </FileConfiguration>
@@ -940,7 +960,7 @@ · 2 unmodified lines
940960 >
941961 <Tool
942962 Name="VCCustomBuildTool"
943− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
963+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
944964 Outputs="$(IntDir)\$(InputName).obj"
945965 />
946966 </FileConfiguration>
@@ -949,7 +969,7 @@ · 2 unmodified lines
949969 >
950970 <Tool
951971 Name="VCCustomBuildTool"
952− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
972+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
953973 Outputs="$(IntDir)\$(InputName).obj"
954974 />
955975 </FileConfiguration>
@@ -958,7 +978,7 @@ · 2 unmodified lines
958978 >
959979 <Tool
960980 Name="VCCustomBuildTool"
961− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
981+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
962982 Outputs="$(IntDir)\$(InputName).obj"
963983 />
964984 </FileConfiguration>
@@ -971,7 +991,7 @@ · 6 unmodified lines
971991 >
972992 <Tool
973993 Name="VCCustomBuildTool"
974− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
994+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
975995 Outputs="$(IntDir)\$(InputName).obj"
976996 />
977997 </FileConfiguration>
@@ -980,7 +1000,7 @@ · 2 unmodified lines
9801000 >
9811001 <Tool
9821002 Name="VCCustomBuildTool"
983− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1003+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
9841004 Outputs="$(IntDir)\$(InputName).obj"
9851005 />
9861006 </FileConfiguration>
@@ -989,7 +1009,7 @@ · 2 unmodified lines
9891009 >
9901010 <Tool
9911011 Name="VCCustomBuildTool"
992− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1012+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
9931013 Outputs="$(IntDir)\$(InputName).obj"
9941014 />
9951015 </FileConfiguration>
@@ -998,7 +1018,7 @@ · 2 unmodified lines
9981018 >
9991019 <Tool
10001020 Name="VCCustomBuildTool"
1001− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1021+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
10021022 Outputs="$(IntDir)\$(InputName).obj"
10031023 />
10041024 </FileConfiguration>
@@ -1011,7 +1031,7 @@ · 6 unmodified lines
10111031 >
10121032 <Tool
10131033 Name="VCCustomBuildTool"
1014− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1034+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
10151035 Outputs="$(IntDir)\$(InputName).obj"
10161036 />
10171037 </FileConfiguration>
@@ -1020,7 +1040,7 @@ · 2 unmodified lines
10201040 >
10211041 <Tool
10221042 Name="VCCustomBuildTool"
1023− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1043+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
10241044 Outputs="$(IntDir)\$(InputName).obj"
10251045 />
10261046 </FileConfiguration>
@@ -1029,7 +1049,7 @@ · 2 unmodified lines
10291049 >
10301050 <Tool
10311051 Name="VCCustomBuildTool"
1032− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1052+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
10331053 Outputs="$(IntDir)\$(InputName).obj"
10341054 />
10351055 </FileConfiguration>
@@ -1038,7 +1058,7 @@ · 2 unmodified lines
10381058 >
10391059 <Tool
10401060 Name="VCCustomBuildTool"
1041− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1061+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
10421062 Outputs="$(IntDir)\$(InputName).obj"
10431063 />
10441064 </FileConfiguration>
@@ -1051,7 +1071,7 @@ · 6 unmodified lines
10511071 >
10521072 <Tool
10531073 Name="VCCustomBuildTool"
1054− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1074+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
10551075 Outputs="$(IntDir)\$(InputName).obj"
10561076 />
10571077 </FileConfiguration>
@@ -1060,7 +1080,7 @@ · 2 unmodified lines
10601080 >
10611081 <Tool
10621082 Name="VCCustomBuildTool"
1063− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1083+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
10641084 Outputs="$(IntDir)\$(InputName).obj"
10651085 />
10661086 </FileConfiguration>
@@ -1069,7 +1089,7 @@ · 2 unmodified lines
10691089 >
10701090 <Tool
10711091 Name="VCCustomBuildTool"
1072− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1092+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
10731093 Outputs="$(IntDir)\$(InputName).obj"
10741094 />
10751095 </FileConfiguration>
@@ -1078,7 +1098,7 @@ · 2 unmodified lines
10781098 >
10791099 <Tool
10801100 Name="VCCustomBuildTool"
1081− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1101+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
10821102 Outputs="$(IntDir)\$(InputName).obj"
10831103 />
10841104 </FileConfiguration>
@@ -1091,7 +1111,7 @@ · 6 unmodified lines
10911111 >
10921112 <Tool
10931113 Name="VCCustomBuildTool"
1094− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1114+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
10951115 Outputs="$(IntDir)\$(InputName).obj"
10961116 />
10971117 </FileConfiguration>
@@ -1100,7 +1120,7 @@ · 2 unmodified lines
11001120 >
11011121 <Tool
11021122 Name="VCCustomBuildTool"
1103− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1123+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
11041124 Outputs="$(IntDir)\$(InputName).obj"
11051125 />
11061126 </FileConfiguration>
@@ -1109,7 +1129,7 @@ · 2 unmodified lines
11091129 >
11101130 <Tool
11111131 Name="VCCustomBuildTool"
1112− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1132+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
11131133 Outputs="$(IntDir)\$(InputName).obj"
11141134 />
11151135 </FileConfiguration>
@@ -1118,7 +1138,7 @@ · 2 unmodified lines
11181138 >
11191139 <Tool
11201140 Name="VCCustomBuildTool"
1121− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1141+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
11221142 Outputs="$(IntDir)\$(InputName).obj"
11231143 />
11241144 </FileConfiguration>
@@ -1131,7 +1151,7 @@ · 6 unmodified lines
11311151 >
11321152 <Tool
11331153 Name="VCCustomBuildTool"
1134− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1154+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
11351155 Outputs="$(IntDir)\$(InputName).obj"
11361156 />
11371157 </FileConfiguration>
@@ -1140,7 +1160,7 @@ · 2 unmodified lines
11401160 >
11411161 <Tool
11421162 Name="VCCustomBuildTool"
1143− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1163+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
11441164 Outputs="$(IntDir)\$(InputName).obj"
11451165 />
11461166 </FileConfiguration>
@@ -1149,7 +1169,7 @@ · 2 unmodified lines
11491169 >
11501170 <Tool
11511171 Name="VCCustomBuildTool"
1152− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1172+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
11531173 Outputs="$(IntDir)\$(InputName).obj"
11541174 />
11551175 </FileConfiguration>
@@ -1158,7 +1178,7 @@ · 2 unmodified lines
11581178 >
11591179 <Tool
11601180 Name="VCCustomBuildTool"
1161− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1181+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
11621182 Outputs="$(IntDir)\$(InputName).obj"
11631183 />
11641184 </FileConfiguration>
@@ -1171,7 +1191,7 @@ · 6 unmodified lines
11711191 >
11721192 <Tool
11731193 Name="VCCustomBuildTool"
1174− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1194+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
11751195 Outputs="$(IntDir)\$(InputName).obj"
11761196 />
11771197 </FileConfiguration>
@@ -1180,7 +1200,7 @@ · 2 unmodified lines
11801200 >
11811201 <Tool
11821202 Name="VCCustomBuildTool"
1183− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1203+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
11841204 Outputs="$(IntDir)\$(InputName).obj"
11851205 />
11861206 </FileConfiguration>
@@ -1189,7 +1209,7 @@ · 2 unmodified lines
11891209 >
11901210 <Tool
11911211 Name="VCCustomBuildTool"
1192− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1212+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
11931213 Outputs="$(IntDir)\$(InputName).obj"
11941214 />
11951215 </FileConfiguration>
@@ -1198,7 +1218,7 @@ · 2 unmodified lines
11981218 >
11991219 <Tool
12001220 Name="VCCustomBuildTool"
1201− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1221+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
12021222 Outputs="$(IntDir)\$(InputName).obj"
12031223 />
12041224 </FileConfiguration>
@@ -1211,7 +1231,7 @@ · 6 unmodified lines
12111231 >
12121232 <Tool
12131233 Name="VCCustomBuildTool"
1214− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1234+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
12151235 Outputs="$(IntDir)\$(InputName).obj"
12161236 />
12171237 </FileConfiguration>
@@ -1220,7 +1240,7 @@ · 2 unmodified lines
12201240 >
12211241 <Tool
12221242 Name="VCCustomBuildTool"
1223− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1243+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
12241244 Outputs="$(IntDir)\$(InputName).obj"
12251245 />
12261246 </FileConfiguration>
@@ -1229,7 +1249,7 @@ · 2 unmodified lines
12291249 >
12301250 <Tool
12311251 Name="VCCustomBuildTool"
1232− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1252+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
12331253 Outputs="$(IntDir)\$(InputName).obj"
12341254 />
12351255 </FileConfiguration>
@@ -1238,7 +1258,7 @@ · 2 unmodified lines
12381258 >
12391259 <Tool
12401260 Name="VCCustomBuildTool"
1241− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1261+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
12421262 Outputs="$(IntDir)\$(InputName).obj"
12431263 />
12441264 </FileConfiguration>
@@ -1251,7 +1271,7 @@ · 6 unmodified lines
12511271 >
12521272 <Tool
12531273 Name="VCCustomBuildTool"
1254− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1274+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
12551275 Outputs="$(IntDir)\$(InputName).obj"
12561276 />
12571277 </FileConfiguration>
@@ -1260,7 +1280,7 @@ · 2 unmodified lines
12601280 >
12611281 <Tool
12621282 Name="VCCustomBuildTool"
1263− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1283+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
12641284 Outputs="$(IntDir)\$(InputName).obj"
12651285 />
12661286 </FileConfiguration>
@@ -1269,7 +1289,7 @@ · 2 unmodified lines
12691289 >
12701290 <Tool
12711291 Name="VCCustomBuildTool"
1272− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1292+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
12731293 Outputs="$(IntDir)\$(InputName).obj"
12741294 />
12751295 </FileConfiguration>
@@ -1278,7 +1298,7 @@ · 2 unmodified lines
12781298 >
12791299 <Tool
12801300 Name="VCCustomBuildTool"
1281− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1301+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
12821302 Outputs="$(IntDir)\$(InputName).obj"
12831303 />
12841304 </FileConfiguration>
@@ -1291,7 +1311,7 @@ · 6 unmodified lines
12911311 >
12921312 <Tool
12931313 Name="VCCustomBuildTool"
1294− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1314+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
12951315 Outputs="$(IntDir)\$(InputName).obj"
12961316 />
12971317 </FileConfiguration>
@@ -1300,7 +1320,7 @@ · 2 unmodified lines
13001320 >
13011321 <Tool
13021322 Name="VCCustomBuildTool"
1303− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1323+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
13041324 Outputs="$(IntDir)\$(InputName).obj"
13051325 />
13061326 </FileConfiguration>
@@ -1309,7 +1329,7 @@ · 2 unmodified lines
13091329 >
13101330 <Tool
13111331 Name="VCCustomBuildTool"
1312− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1332+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
13131333 Outputs="$(IntDir)\$(InputName).obj"
13141334 />
13151335 </FileConfiguration>
@@ -1318,7 +1338,7 @@ · 2 unmodified lines
13181338 >
13191339 <Tool
13201340 Name="VCCustomBuildTool"
1321− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1341+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
13221342 Outputs="$(IntDir)\$(InputName).obj"
13231343 />
13241344 </FileConfiguration>
@@ -1331,7 +1351,7 @@ · 6 unmodified lines
13311351 >
13321352 <Tool
13331353 Name="VCCustomBuildTool"
1334− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1354+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
13351355 Outputs="$(IntDir)\$(InputName).obj"
13361356 />
13371357 </FileConfiguration>
@@ -1340,7 +1360,7 @@ · 2 unmodified lines
13401360 >
13411361 <Tool
13421362 Name="VCCustomBuildTool"
1343− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1363+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
13441364 Outputs="$(IntDir)\$(InputName).obj"
13451365 />
13461366 </FileConfiguration>
@@ -1349,7 +1369,7 @@ · 2 unmodified lines
13491369 >
13501370 <Tool
13511371 Name="VCCustomBuildTool"
1352− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1372+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
13531373 Outputs="$(IntDir)\$(InputName).obj"
13541374 />
13551375 </FileConfiguration>
@@ -1358,7 +1378,7 @@ · 2 unmodified lines
13581378 >
13591379 <Tool
13601380 Name="VCCustomBuildTool"
1361− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1381+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
13621382 Outputs="$(IntDir)\$(InputName).obj"
13631383 />
13641384 </FileConfiguration>
@@ -1371,7 +1391,7 @@ · 6 unmodified lines
13711391 >
13721392 <Tool
13731393 Name="VCCustomBuildTool"
1374− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1394+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
13751395 Outputs="$(IntDir)\$(InputName).obj"
13761396 />
13771397 </FileConfiguration>
@@ -1380,7 +1400,7 @@ · 2 unmodified lines
13801400 >
13811401 <Tool
13821402 Name="VCCustomBuildTool"
1383− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1403+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
13841404 Outputs="$(IntDir)\$(InputName).obj"
13851405 />
13861406 </FileConfiguration>
@@ -1389,7 +1409,7 @@ · 2 unmodified lines
13891409 >
13901410 <Tool
13911411 Name="VCCustomBuildTool"
1392− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1412+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win32 -DPREFIX -DX86_32 -o $(IntDir)\$(InputName).obj $(InputPath);"
13931413 Outputs="$(IntDir)\$(InputName).obj"
13941414 />
13951415 </FileConfiguration>
@@ -1398,7 +1418,7 @@ · 2 unmodified lines
13981418 >
13991419 <Tool
14001420 Name="VCCustomBuildTool"
1401− CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath)&#x0D;&#x0A;"
1421+ CommandLine="nasm -I$(InputDir) -I$(InputDir)/../../../common/x86/ -f win64 -DWIN64 -o $(IntDir)\$(InputName).obj $(InputPath);"
14021422 Outputs="$(IntDir)\$(InputName).obj"
14031423 />
14041424 </FileConfiguration>
codec/console/enc/src/welsenc.cpp+6−0
@@ -238,6 +238,8 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv · 237 unmodified lines
238238 pSvcParam.bEnableSSEI = atoi (strTag[1].c_str()) ? true : false;
239239 } else if (strTag[0].compare ("EnableFrameCropping") == 0) {
240240 pSvcParam.bEnableFrameCroppingFlag = (atoi (strTag[1].c_str()) != 0);
241+ } else if (strTag[0].compare ("EntropyCodingModeFlag") == 0) {
242+ pSvcParam.iEntropyCodingModeFlag = (atoi (strTag[1].c_str()) != 0);
241243 } else if (strTag[0].compare ("LoopFilterDisableIDC") == 0) {
242244 pSvcParam.iLoopFilterDisableIdc = (int8_t)atoi (strTag[1].c_str());
243245 if (pSvcParam.iLoopFilterDisableIdc > 6 || pSvcParam.iLoopFilterDisableIdc < 0) {
@@ -354,6 +356,7 @@ void PrintHelp() { · 110 unmodified lines
354356 printf (" -iper Intra period (default: -1) : must be a power of 2 of GOP size (or -1)\n");
355357 printf (" -nalsize the Maximum NAL size. which should be larger than the each layer slicesize when slice mode equals to SM_DYN_SLICE\n");
356358 printf (" -spsid Enable id adding in SPS/PPS per IDR \n");
359+ printf (" -cabac Entropy coding mode(0:cavlc 1:cabac \n");
357360 printf (" -denois Control denoising (default: 0)\n");
358361 printf (" -scene Control scene change detection (default: 0)\n");
359362 printf (" -bgd Control background detection (default: 0)\n");
@@ -420,6 +423,9 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE · 60 unmodified lines
420423 else if (!strcmp (pCommand, "-spsid") && (n < argc))
421424 pSvcParam.bEnableSpsPpsIdAddition = atoi (argv[n++]) ? true : false;
422425
426+ else if (!strcmp (pCommand, "-cabac") && (n < argc))
427+ pSvcParam.iEntropyCodingModeFlag = atoi (argv[n++]);
428+
423429 else if (!strcmp (pCommand, "-denois") && (n < argc))
424430 pSvcParam.bEnableDenoise = atoi (argv[n++]) ? true : false;
425431
codec/encoder/core/inc/au_set.h+2−1
@@ -138,7 +138,8 @@ int32_t WelsInitPps (SWelsPPS* pPps, · 137 unmodified lines
138138 SSubsetSps* pSubsetSps,
139139 const uint32_t kuiPpsId,
140140 const bool kbDeblockingFilterPresentFlag,
141− const bool kbUsingSubsetSps);
141+ const bool kbUsingSubsetSps,
142+ const bool kbEntropyCodingModeFlag);
142143 int32_t WelsCheckRefFrameLimitation (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam);
143144 }
144145 #endif//WELS_ACCESS_UNIT_PARSER_H__
codec/encoder/core/inc/encoder.h+1−1
@@ -70,7 +70,7 @@ int32_t AllocateBsOutputBuffer (CMemoryAlign* pMa, const int32_t iNeededLen, int · 69 unmodified lines
7070 * \param pEncCtx sWelsEncCtx*
7171 * \return successful - 0; otherwise none 0 for failed
7272 */
73−int32_t InitFunctionPointers (SWelsFuncPtrList* pFuncList, SWelsSvcCodingParam* _param, uint32_t uiCpuFlag);
73+int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* _param, uint32_t uiCpuFlag);
7474
7575 ///*!
7676 // * \brief decide frame type (IDR/P frame)
codec/encoder/core/inc/encoder_context.h+1−1
@@ -225,7 +225,7 @@ typedef struct TagWelsEncCtx { · 224 unmodified lines
225225 int32_t iEncoderError;
226226 WELS_MUTEX mutexEncoderError;
227227 bool bDeliveryFlag;
228−
228+ SStateCtx sWelsCabacContexts[4][WELS_QP_MAX + 1][WELS_CONTEXT_COUNT];
229229 #ifdef ENABLE_FRAME_DUMP
230230 bool bDependencyRecFlag[MAX_DEPENDENCY_LAYER];
231231 bool bRecFlag;
codec/encoder/core/inc/param_svc.h+6−5
@@ -157,7 +157,7 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt { · 156 unmodified lines
157157 /* Rate Control */
158158 param.iRCMode = RC_QUALITY_MODE;
159159 param.iPaddingFlag = 0;
160−
160+ param.iEntropyCodingModeFlag = 0;
161161 param.bEnableDenoise = false; // denoise control
162162 param.bEnableSceneChangeDetect = true; // scene change detection control
163163 param.bEnableBackgroundDetection = true; // background detection control
@@ -240,7 +240,8 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt { · 76 unmodified lines
240240
241241 int8_t iIdxSpatial = 0;
242242 EProfileIdc uiProfileIdc = PRO_BASELINE;
243−
243+ if (iEntropyCodingModeFlag)
244+ uiProfileIdc = PRO_MAIN;
244245 SSpatialLayerInternal* pDlp = &sDependencyLayers[0];
245246
246247 while (iIdxSpatial < iSpatialLayerNum) {
@@ -298,7 +299,7 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt { · 51 unmodified lines
298299 iLoopFilterDisableIdc = pCodingParam.iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries,
299300 iLoopFilterAlphaC0Offset = pCodingParam.iLoopFilterAlphaC0Offset; // AlphaOffset: valid range [-6, 6], default 0
300301 iLoopFilterBetaOffset = pCodingParam.iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
301−
302+ iEntropyCodingModeFlag = pCodingParam.iEntropyCodingModeFlag;
302303 bEnableFrameCroppingFlag = pCodingParam.bEnableFrameCroppingFlag;
303304
304305 /* Rate Control */
@@ -459,7 +460,7 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt { · 154 unmodified lines
459460 const uint8_t* pTemporalIdList = &g_kuiTemporalIdListTable[iDecStages][0];
460461 SSpatialLayerInternal* pDlp = &sDependencyLayers[0];
461462 SSpatialLayerConfig* pSpatialLayer = &sSpatialLayers[0];
462− EProfileIdc uiProfileIdc = PRO_BASELINE;
463+ EProfileIdc uiProfileIdc = iEntropyCodingModeFlag ? PRO_MAIN : PRO_BASELINE;
463464 int8_t i = 0;
464465
465466 while (i < iSpatialLayerNum) {
@@ -492,7 +493,7 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt { · 26 unmodified lines
492493 return ENC_RETURN_INVALIDINPUT;
493494 }
494495
495− uiProfileIdc = PRO_SCALABLE_BASELINE;
496+ uiProfileIdc = iEntropyCodingModeFlag ? PRO_SCALABLE_HIGH : PRO_SCALABLE_BASELINE;
496497 ++ pDlp;
497498 ++ pSpatialLayer;
498499 ++ i;
codec/encoder/core/inc/parameter_sets.h+1−1
@@ -147,7 +147,7 @@ uint8_t uiChromaQpIndexOffset; · 146 unmodified lines
147147 // /* potential application for High profile */
148148
149149 // bool bPicOrderPresentFlag;
150−
150+bool bEntropyCodingModeFlag;
151151 bool bDeblockingFilterControlPresentFlag;
152152
153153 // bool bConstainedIntraPredFlag;
codec/encoder/core/inc/set_mb_syn_cabac.h+89−0
@@ -0,0 +1,89 @@
1+/*!
2+ * \copy
3+ * Copyright (c) 2009-2013, Cisco Systems
4+ * All rights reserved.
5+ *
6+ * Redistribution and use in source and binary forms, with or without
7+ * modification, are permitted provided that the following conditions
8+ * are met:
9+ *
10+ * * Redistributions of source code must retain the above copyright
11+ * notice, this list of conditions and the following disclaimer.
12+ *
13+ * * Redistributions in binary form must reproduce the above copyright
14+ * notice, this list of conditions and the following disclaimer in
15+ * the documentation and/or other materials provided with the
16+ * distribution.
17+ *
18+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+ * POSSIBILITY OF SUCH DAMAGE.
30+ *
31+ *
32+ * \file set_mb_syn_cabac.h
33+ *
34+ * \brief Seting all syntax elements of mb and encoding residual with cabac
35+ *
36+ * \date 09/27/2014 Created
37+ *
38+ *************************************************************************************
39+ */
40+
41+#ifndef SET_MB_SYN_CABAC_H_
42+#define SET_MB_SYN_CABAC_H_
43+
44+#include "typedefs.h"
45+#include "bit_stream.h"
46+
47+namespace WelsEnc {
48+
49+#define WELS_QP_MAX 51
50+#define WELS_CONTEXT_COUNT 460
51+#define CTX_NA 0
52+
53+typedef struct TagStateCtx {
54+ uint8_t m_uiState;
55+ uint8_t m_uiValMps;
56+} SStateCtx;
57+typedef struct TagCabacCtx {
58+ uint32_t m_uiLow;
59+ uint32_t m_uiRange;
60+ SStateCtx m_sStateCtx[WELS_CONTEXT_COUNT];
61+ uint8_t* m_pBufStart;
62+ uint8_t* m_pBufEnd;
63+ uint8_t* m_pBufCur;
64+ uint8_t m_iBitsOutstanding;
65+ uint32_t m_uData;
66+ uint32_t m_uiBitsUsed;
67+ uint32_t m_iFirstFlag;
68+ uint32_t m_uiBinCountsInNalUnits;
69+} SCabacCtx;
70+
71+
72+extern const uint8_t g_kuiCabacRangeLps[64][4];
73+extern const int8_t g_kiCabacGlobalContextIdx[WELS_CONTEXT_COUNT][4][2];
74+extern const uint8_t g_kuiStateTransTable[64][2];
75+
76+void WelsCabacContextInit (void* pCtx,SCabacCtx* pCbCtx,int32_t iModel);
77+void WelsCabacEncodeInit (SCabacCtx* pCbCtx, uint8_t* pBuf, uint8_t* pEnd);
78+void WelsCabacEncodeDecision (SCabacCtx* pCbCtx, int32_t iCtx, uint32_t uiBin);
79+void WelsCabacEncodeBypassOne (SCabacCtx* pCbCtx, uint32_t uiBin);
80+void WelsCabacEncodeTerminate (SCabacCtx* pCbCtx, uint32_t uiBin);
81+void WelsCabacEncodeUeBypass (SCabacCtx* pCbCtx, int32_t iExpBits, uint32_t uiVal);
82+void WelsCabacEncodeFlush (SCabacCtx* pCbCtx);
83+uint8_t* WelsCabacEncodeGetPtr (SCabacCtx* pCbCtx);
84+int32_t WriteBlockResidualCabac (void* pEncCtx, int16_t* pCoffLevel, int32_t iEndIdx,
85+ int32_t iCalRunLevelFlag,
86+ int32_t iResidualProperty, int8_t iNC, SBitStringAux* pBs);
87+
88+}
89+#endif
codec/encoder/core/inc/set_mb_syn_cavlc.h+11−11
@@ -48,30 +48,30 @@ · 47 unmodified lines
4848 namespace WelsEnc {
4949
5050
51−
52−enum EResidualProperty {
53−LUMA_DC = 0,
54−LUMA_AC = 1,
55−LUMA_4x4 = 2,
56−CHROMA_DC = 3,
57−CHROMA_AC = 4
51+enum ECtxBlockCat {
52+ LUMA_DC = 0,
53+ LUMA_AC = 1,
54+ LUMA_4x4 = 2,
55+ CHROMA_DC = 3,
56+ CHROMA_AC = 4
5857 };
5958
6059
6160 #define LUMA_DC_AC 0x04
6261
6362 typedef struct TagCavlcTableItem {
64−uint16_t uiBits;
65−uint8_t uiLen;
66−uint8_t uiSuffixLength;
63+ uint16_t uiBits;
64+ uint8_t uiLen;
65+ uint8_t uiSuffixLength;
6766 } SCavlcTableItem;
6867
69−void InitCoeffFunc (SWelsFuncPtrList* pFuncList, const uint32_t uiCpuFlag);
68+void InitCoeffFunc (SWelsFuncPtrList* pFuncList, const uint32_t uiCpuFlag,int32_t iEntropyCodingModeFlag);
7069
7170 int32_t WriteBlockResidualCavlc (SWelsFuncPtrList* pFuncList, int16_t* pCoffLevel, int32_t iEndIdx,
7271 int32_t iCalRunLevelFlag,
7372 int32_t iResidualProperty, int8_t iNC, SBitStringAux* pBs);
7473
74+
7575 #if defined(__cplusplus)
7676 extern "C" {
7777 #endif//__cplusplus
codec/encoder/core/inc/slice.h+5−1
@@ -42,7 +42,7 @@ · 41 unmodified lines
4242 #include "parameter_sets.h"
4343 #include "svc_enc_slice_segment.h"
4444 #include "bit_stream.h"
45−
45+#include "set_mb_syn_cabac.h"
4646
4747 namespace WelsEnc {
4848
@@ -178,6 +178,10 @@ uint8_t uiAssumeLog2BytePerMb; · 129 unmodified lines
178178 uint32_t uiSliceFMECostDown;//TODO: for FME switch under MT, to opt after ME final?
179179
180180 uint8_t uiReservedFillByte; // reserved to meet 4 bytes alignment
181+
182+SCabacCtx sCabacCtx;
183+int32_t iCabacInitIdc;
184+int32_t iMbSkipRun;
181185 } SSlice, *PSlice;
182186
183187 }
codec/encoder/core/inc/svc_enc_golomb.h+10−1
@@ -171,7 +171,6 @@ pBs->pBufPtr += 4 - pBs->iLeftBits / 8; · 170 unmodified lines
171171 pBs->iLeftBits = 32;
172172 pBs->uiCurBits = 0; // for future writing safe, 5/19/2010
173173 }
174−
175174 /*
176175 * Write unsigned exp golomb codes
177176 */
@@ -246,5 +245,15 @@ static inline int32_t BsGetBitsPos (SBitStringAux* pBs) { · 68 unmodified lines
246245 return (int32_t) (((pBs->pBufPtr - pBs->pBuf) << 3) + 32 - pBs->iLeftBits);
247246 }
248247
248+static inline void BsAlign( SBitStringAux* pBs )
249+{
250+ if( pBs->iLeftBits&7 )
251+ {
252+ pBs->uiCurBits <<= pBs->iLeftBits&7;
253+ pBs->uiCurBits |= (1 << (pBs->iLeftBits&7)) - 1;
254+ pBs->iLeftBits &= ~7;
255+ }
256+ BsFlush(pBs );
257+}
249258 }
250259 #endif//WELS_EXPONENTIAL_GOLOMB_ENTROPY_CODING_H__
codec/encoder/core/inc/svc_enc_macroblock.h+4−0
@@ -69,6 +69,10 @@ SMVUnitXY sP16x16Mv; · 68 unmodified lines
6969 uint8_t uiLumaQp; // uiLumaQp: pPps->iInitialQp + sSliceHeader->delta_qp + mb->dquant.
7070 uint8_t uiChromaQp;
7171 uint8_t uiSliceIdc; // AVC: pFirstMbInSlice?; SVC: (pFirstMbInSlice << 7) | ((uiDependencyId << 4) | uiQualityId);
72+uint32_t uiChromPredMode;
73+int32_t iLumaDQp;
74+SMVUnitXY sMvd[4];
75+int32_t iCbpDc;
7276 uint8_t reserved_filling_bytes[1]; // filling bytes reserved to make structure aligned with 4 bytes, higher cache hit on less structure size by 2 cache lines( 2 * 64 bytes) once hit
7377 } SMB, *PMb;
7478
codec/encoder/core/inc/svc_enc_slice_segment.h+4−1
@@ -46,6 +46,8 @@ · 45 unmodified lines
4646 #include "memory_align.h"
4747
4848 #include "codec_app_def.h"
49+#include "set_mb_syn_cabac.h"
50+
4951 namespace WelsEnc {
5052
5153
@@ -90,10 +92,11 @@ typedef struct TagDynamicSlicingStack { · 38 unmodified lines
9092 int32_t iStartPos;
9193 int32_t iCurrentPos;
9294
93−uint8_t* pBsStackBufPtr; // current writing position
95+uint8_t* pBsStackBufPtr; // current writing position
9496 uint32_t uiBsStackCurBits;
9597 int32_t iBsStackLeftBits;
9698
99+SCabacCtx sStoredCabac;
97100 int32_t iMbSkipRunStack;
98101 uint8_t uiLastMbQp;
99102 } SDynamicSlicingStack;
codec/encoder/core/inc/svc_set_mb_syn.h+68−0
@@ -0,0 +1,68 @@
1+/*!
2+ * \copy
3+ * Copyright (c) 2009-2013, Cisco Systems
4+ * All rights reserved.
5+ *
6+ * Redistribution and use in source and binary forms, with or without
7+ * modification, are permitted provided that the following conditions
8+ * are met:
9+ *
10+ * * Redistributions of source code must retain the above copyright
11+ * notice, this list of conditions and the following disclaimer.
12+ *
13+ * * Redistributions in binary form must reproduce the above copyright
14+ * notice, this list of conditions and the following disclaimer in
15+ * the documentation and/or other materials provided with the
16+ * distribution.
17+ *
18+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+ * POSSIBILITY OF SUCH DAMAGE.
30+ *
31+ *
32+ * \file svc_set_mb_syn.h
33+ *
34+ * \brief Seting all syntax elements of mb and encoding residual with cavlc and cabac
35+ *
36+ * \date 2009.8.12 Created
37+ *
38+ *************************************************************************************
39+ */
40+
41+#ifndef SVC_SET_MB_SYN_H_
42+#define SVC_SET_MB_SYN_H_
43+
44+#include "typedefs.h"
45+#include "wels_common_basis.h"
46+#include "encoder_context.h"
47+#include "md.h"
48+#include "slice.h"
49+#include "set_mb_syn_cavlc.h"
50+#include "set_mb_syn_cabac.h"
51+
52+namespace WelsEnc {
53+
54+
55+
56+int32_t WelsWriteMbResidual (SWelsFuncPtrList* pFuncList, SMbCache* sMbCacheInfo, SMB* pCurMb, SBitStringAux* pBs);
57+
58+void WelsSpatialWriteSubMbPred (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb);
59+
60+void WelsSpatialWriteMbPred (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb);
61+void WelsInitSliceCabac(sWelsEncCtx* pEncCtx,SSlice* pSlice);
62+void WelsCabacInit(void *pCtx);
63+void WelsWriteSliceEndSyn(SSlice *pSlice,bool bEntropyCodingModeFlag);
64+//for Base Layer CAVLC writing
65+int32_t WelsSpatialWriteMbSyn (void* Ctx, SSlice* pSlice, SMB* pCurMb);
66+int32_t WelsSpatialWriteMbSynCabac (void* pCtx, SSlice* pSlice, SMB* pCurMb);
67+}
68+#endif
codec/encoder/core/inc/svc_set_mb_syn_cavlc.h+8−4
@@ -37,7 +37,6 @@ · 36 unmodified lines
3737 *
3838 *************************************************************************************
3939 */
40−
4140 #ifndef SVC_SET_MB_SYN_CAVLC_H_
4241 #define SVC_SET_MB_SYN_CAVLC_H_
4342
@@ -45,19 +44,24 @@ · 1 unmodified line
4544 #include "wels_common_basis.h"
4645 #include "encoder_context.h"
4746 #include "md.h"
48−
47+#include "slice.h"
4948 #include "set_mb_syn_cavlc.h"
49+#include "set_mb_syn_cabac.h"
5050
5151 namespace WelsEnc {
5252
53+
54+
5355 int32_t WelsWriteMbResidual (SWelsFuncPtrList* pFuncList, SMbCache* sMbCacheInfo, SMB* pCurMb, SBitStringAux* pBs);
5456
5557 void WelsSpatialWriteSubMbPred (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb);
5658
5759 void WelsSpatialWriteMbPred (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb);
58−
60+void WelsInitSliceCabac(sWelsEncCtx* pEncCtx,SSlice* pSlice);
61+void WelsWriteSliceEndSyn(SSlice *pSlice,bool bEntropyCodingModeFlag);
5962 //for Base Layer CAVLC writing
60−int32_t WelsSpatialWriteMbSyn (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb);
63+int32_t WelsSpatialWriteMbSyn (void* Ctx, SSlice* pSlice, SMB* pCurMb);
64+int32_t WelsSpatialWriteMbSynCabac (void* pCtx, SSlice* pSlice, SMB* pCurMb);
6165
6266 }
6367 #endif
codec/encoder/core/inc/wels_common_basis.h+48−43
@@ -47,40 +47,45 @@ namespace WelsEnc { · 46 unmodified lines
4747
4848
4949 struct SMVUnitXY { // each 4 Bytes
50−int16_t iMvX;
51−int16_t iMvY;
50+ int16_t iMvX;
51+ int16_t iMvY;
5252 public:
53−SMVUnitXY& sDeltaMv (const SMVUnitXY& _v0, const SMVUnitXY& _v1) {
54− iMvX = _v0.iMvX - _v1.iMvX;
55− iMvY = _v0.iMvY - _v1.iMvY;
56− return (*this);
57−}
53+ SMVUnitXY& sDeltaMv (const SMVUnitXY& _v0, const SMVUnitXY& _v1) {
54+ iMvX = _v0.iMvX - _v1.iMvX;
55+ iMvY = _v0.iMvY - _v1.iMvY;
56+ return (*this);
57+ };
58+ SMVUnitXY& sAssginMv (const SMVUnitXY& _v0) {
59+ iMvX = _v0.iMvX;
60+ iMvY = _v0.iMvY;
61+ return (*this);
62+ };
5863 };
5964
6065 typedef struct TagMVComponentUnit { // each LIST_0/LIST_1
61−SMVUnitXY sMotionVectorCache[5 * 6 - 1]; // Luma only: 5 x 6 - 1 = 29 D-Words
62−int8_t iRefIndexCache[5 * 6]; // Luma only: 5 x 6 = 30 bytes
66+ SMVUnitXY sMotionVectorCache[5 * 6 - 1]; // Luma only: 5 x 6 - 1 = 29 D-Words
67+ int8_t iRefIndexCache[5 * 6]; // Luma only: 5 x 6 = 30 bytes
6368 } SMVComponentUnit, *PMVComponentUnit;
6469
6570
6671 typedef struct TagParaSetOffsetVariable {
67−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
72+ 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
6873 //need not extra +1 due no MGS and FMO case so far
69−bool bUsedParaSetIdInBs[MAX_PPS_COUNT]; //mark the used SPS_ID with 1
70−uint32_t uiNextParaSetIdToUseInBs; //mark the next SPS_ID_in_bs, for all layers
74+ bool bUsedParaSetIdInBs[MAX_PPS_COUNT]; //mark the used SPS_ID with 1
75+ uint32_t uiNextParaSetIdToUseInBs; //mark the next SPS_ID_in_bs, for all layers
7176 } SParaSetOffsetVariable;
7277
7378 typedef struct TagParaSetOffset {
7479 //in PS0 design, "sParaSetOffsetVariable" record the previous paras before current IDR, AND NEED to be stacked and recover across IDR
75−SParaSetOffsetVariable
76−sParaSetOffsetVariable[PARA_SET_TYPE]; //PARA_SET_TYPE=3; paraset_type = 0: AVC_SPS; =1: Subset_SPS; =2: PPS
80+ SParaSetOffsetVariable
81+ sParaSetOffsetVariable[PARA_SET_TYPE]; //PARA_SET_TYPE=3; paraset_type = 0: AVC_SPS; =1: Subset_SPS; =2: PPS
7782 //in PSO design, "bPpsIdMappingIntoSubsetsps" uses the current para of current IDR period
78−bool
79−bPpsIdMappingIntoSubsetsps[MAX_DQ_LAYER_NUM/*+1*/]; // need not extra +1 due no MGS and FMO case so far
80−uint16_t
81−uiIdrPicId; // IDR picture id: [0, 65535], this one is used for LTR!! Can we just NOT put this into the SParaSetOffset structure?!!
83+ bool
84+ bPpsIdMappingIntoSubsetsps[MAX_DQ_LAYER_NUM/*+1*/]; // need not extra +1 due no MGS and FMO case so far
85+ uint16_t
86+ uiIdrPicId; // IDR picture id: [0, 65535], this one is used for LTR!! Can we just NOT put this into the SParaSetOffset structure?!!
8287 #if _DEBUG
83−bool bEnableSpsPpsIdAddition;
88+ bool bEnableSpsPpsIdAddition;
8489 #endif
8590 } SParaSetOffset;
8691
@@ -88,32 +93,32 @@ bool bEnableSpsPpsIdAddition; · 1 unmodified line
8893
8994 /* Position Offset structure */
9095 typedef struct TagCropOffset {
91−int16_t iCropLeft;
92−int16_t iCropRight;
93−int16_t iCropTop;
94−int16_t iCropBottom;
96+ int16_t iCropLeft;
97+ int16_t iCropRight;
98+ int16_t iCropTop;
99+ int16_t iCropBottom;
95100 } SCropOffset;
96101
97102
98103 /* Transform Type */
99104
100105 enum ETransType {
101−T_4x4 = 0,
102−T_8x8 = 1,
103−T_16x16 = 2,
104−T_PCM = 3
106+ T_4x4 = 0,
107+ T_8x8 = 1,
108+ T_16x16 = 2,
109+ T_PCM = 3
105110 };
106111
107112 enum EMbPosition {
108−LEFT_MB_POS = 0x01, // A
109−TOP_MB_POS = 0x02, // B
110−TOPRIGHT_MB_POS = 0x04, // C
111−TOPLEFT_MB_POS = 0x08, // D,
112−RIGHT_MB_POS = 0x10, // add followed four case to reuse when intra up-sample
113−BOTTOM_MB_POS = 0x20, //
114−BOTTOMRIGHT_MB_POS = 0x40, //
115−BOTTOMLEFT_MB_POS = 0x80, //
116−MB_POS_A = 0x100
113+ LEFT_MB_POS = 0x01, // A
114+ TOP_MB_POS = 0x02, // B
115+ TOPRIGHT_MB_POS = 0x04, // C
116+ TOPLEFT_MB_POS = 0x08, // D,
117+ RIGHT_MB_POS = 0x10, // add followed four case to reuse when intra up-sample
118+ BOTTOM_MB_POS = 0x20, //
119+ BOTTOMRIGHT_MB_POS = 0x40, //
120+ BOTTOMLEFT_MB_POS = 0x80, //
121+ MB_POS_A = 0x100
117122 };
118123 #define MB_ON_PIC_BOUNDRY (RIGHT_MB_POS|BOTTOM_MB_POS|LEFT_MB_POS|TOP_MB_POS)
119124
@@ -180,13 +185,13 @@ typedef uint32_t Mb_Type; · 60 unmodified lines
180185
181186
182187 enum {
183−Intra4x4 = 0,
184−Intra16x16 = 1,
185−Inter16x16 = 2,
186−Inter16x8 = 3,
187−Inter8x16 = 4,
188−Inter8x8 = 5,
189−PSkip = 6
188+ Intra4x4 = 0,
189+ Intra16x16 = 1,
190+ Inter16x16 = 2,
191+ Inter16x8 = 3,
192+ Inter8x16 = 4,
193+ Inter8x8 = 5,
194+ PSkip = 6
190195 };
191196
192197
codec/encoder/core/inc/wels_func_ptr_def.h+10−3
@@ -160,9 +160,10 @@ typedef void (*PLineFullSearchFunc) (SWelsFuncPtrList* pFuncList, SWelsME* pMe, · 159 unmodified lines
160160 const int16_t kiMinMv, const int16_t kiMaxMv,
161161 const bool bVerticalSearch);
162162 typedef void (*PInitializeHashforFeatureFunc) (uint32_t* pTimesOfFeatureValue, uint16_t* pBuf, const int32_t kiListSize,
163− uint16_t** pLocationOfFeature, uint16_t** pFeatureValuePointerList);
164−typedef void (*PFillQpelLocationByFeatureValueFunc) (uint16_t* pFeatureOfBlock, const int32_t kiWidth, const int32_t kiHeight,
165− uint16_t** pFeatureValuePointerList);
163+ uint16_t** pLocationOfFeature, uint16_t** pFeatureValuePointerList);
164+typedef void (*PFillQpelLocationByFeatureValueFunc) (uint16_t* pFeatureOfBlock, const int32_t kiWidth,
165+ const int32_t kiHeight,
166+ uint16_t** pFeatureValuePointerList);
166167 typedef void (*PCalculateBlockFeatureOfFrame) (uint8_t* pRef, const int32_t kiWidth, const int32_t kiHeight,
167168 const int32_t kiRefStride,
168169 uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]);
@@ -200,6 +201,9 @@ typedef void (*PAfterBuildRefListFunc) (void* pCtx); · 31 unmodified lines
200201
201202 typedef int32_t (*PCavlcParamCalFunc) (int16_t* pCoff, uint8_t* pRun, int16_t* pLevel, int32_t* pTotalCoeffs,
202203 int32_t iEndIdx);
204+typedef int32_t (*PWelsSpatialWriteMbSyn) (void* pCtx, SSlice* pSlice, SMB* pCurMb);
205+typedef void (*PStashMBStatus) (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice, int32_t iMbSkipRun);
206+typedef int32_t (*PStashPopMBStatus) (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice);
203207
204208 struct TagWelsFuncPointerList {
205209 SExpandPicFunc sExpandPicFunc;
@@ -297,6 +301,9 @@ struct TagWelsFuncPointerList { · 91 unmodified lines
297301 PAfterBuildRefListFunc pAfterBuildRefList;
298302
299303 PCavlcParamCalFunc pfCavlcParamCal;
304+ PWelsSpatialWriteMbSyn pfWelsSpatialWriteMbSyn;
305+ PStashMBStatus pfStashMBStatus;
306+ PStashPopMBStatus pfStashPopMBStatus;
300307 };
301308
302309 } //end of namespace WelsEnc {
codec/encoder/core/src/au_set.cpp+4−2
@@ -266,7 +266,7 @@ int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, SParaS · 265 unmodified lines
266266 }
267267 #endif
268268
269− BsWriteOneBit (pLocalBitStringAux, false/*pPps->entropy_coding_mode_flag*/);
269+ BsWriteOneBit (pLocalBitStringAux, pPps->bEntropyCodingModeFlag);
270270 BsWriteOneBit (pLocalBitStringAux, false/*pPps->bPicOrderPresentFlag*/);
271271
272272 #ifdef DISABLE_FMO_FEATURE
@@ -414,7 +414,8 @@ int32_t WelsInitPps (SWelsPPS* pPps, · 141 unmodified lines
414414 SSubsetSps* pSubsetSps,
415415 const uint32_t kuiPpsId,
416416 const bool kbDeblockingFilterPresentFlag,
417− const bool kbUsingSubsetSps) {
417+ const bool kbUsingSubsetSps,
418+ const bool kbEntropyCodingModeFlag) {
418419 SWelsSPS* pUsedSps = NULL;
419420 if (pPps == NULL || (pSps == NULL && pSubsetSps == NULL))
420421 return 1;
@@ -433,6 +434,7 @@ int32_t WelsInitPps (SWelsPPS* pPps, · 12 unmodified lines
433434 /* fill picture parameter set syntax */
434435 pPps->iPpsId = kuiPpsId;
435436 pPps->iSpsId = pUsedSps->uiSpsId;
437+ pPps->bEntropyCodingModeFlag = kbEntropyCodingModeFlag;
436438 #if !defined(DISABLE_FMO_FEATURE)
437439 pPps->uiNumSliceGroups = 1; //param->qos_param.sliceGroupCount;
438440 if (pPps->uiNumSliceGroups > 1) {
codec/encoder/core/src/cabac.cpp+557−0
@@ -0,0 +1,557 @@
1+/*!
2+ * \copy
3+ * Copyright (c) 2009-2013, Cisco Systems
4+ * All rights reserved.
5+ *
6+ * Redistribution and use in source and binary forms, with or without
7+ * modification, are permitted provided that the following conditions
8+ * are met:
9+ *
10+ * * Redistributions of source code must retain the above copyright
11+ * notice, this list of conditions and the following disclaimer.
12+ *
13+ * * Redistributions in binary form must reproduce the above copyright
14+ * notice, this list of conditions and the following disclaimer in
15+ * the documentation and/or other materials provided with the
16+ * distribution.
17+ *
18+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+ * POSSIBILITY OF SUCH DAMAGE.
30+ *
31+ *
32+ * \file cabac.cpp
33+ *
34+ * \brief cabac table
35+ *
36+ * \date 10/11/2014 Created
37+ *
38+ *************************************************************************************
39+ */
40+#include "typedefs.h"
41+#include "set_mb_syn_cabac.h"
42+
43+
44+namespace WelsEnc {
45+
46+/* this table is from Table9-12 to Table 9-24 */
47+
48+const int8_t g_kiCabacGlobalContextIdx[WELS_CONTEXT_COUNT][4][2] = {
49+ //0-10 Table 9-12
50+ {{20, -15}, {20, -15}, {20, -15}, {20, -15}},
51+ {{2, 54}, {2, 54}, {2, 54}, {2, 54}},
52+ {{3, 74}, {3, 74}, {3, 74}, {3, 74}},
53+ {{20, -15}, {20, -15}, {20, -15}, {20, -15}},
54+ {{2, 54}, {2, 54}, {2, 54}, {2, 54}},
55+ {{3, 74}, {3, 74}, {3, 74}, {3, 74}},
56+ {{ -28, 127}, { -28, 127}, { -28, 127}, { -28, 127}},
57+ {{ -23, 104}, { -23, 104}, { -23, 104}, { -23, 104}},
58+ {{ -6, 53}, { -6, 53}, { -6, 53}, { -6, 53}},
59+ {{ -1, 54}, { -1, 54}, { -1, 54}, { -1, 54}},
60+ {{7, 51}, {7, 51}, {7, 51}, {7, 51}},
61+ //11-23 Table 9-13
62+ {{CTX_NA, CTX_NA}, {23, 33}, {22, 25}, {29, 16}},
63+ {{CTX_NA, CTX_NA}, {23, 2}, {34, 0}, {25, 0}},
64+ {{CTX_NA, CTX_NA}, {21, 0}, {16, 0}, {14, 0}},
65+ {{CTX_NA, CTX_NA}, {1, 9}, { -2, 9}, { -10, 51}},
66+ {{CTX_NA, CTX_NA}, {0, 49}, {4, 41}, { -3, 62}},
67+ {{CTX_NA, CTX_NA}, { -37, 118}, { -29, 118}, { -27, 99}},
68+ {{CTX_NA, CTX_NA}, {5, 57}, {2, 65}, {26, 16}},
69+ {{CTX_NA, CTX_NA}, { -13, 78}, { -6, 71}, { -4, 85}},
70+ {{CTX_NA, CTX_NA}, { -11, 65}, { -13, 79}, { -24, 102}},
71+ {{CTX_NA, CTX_NA}, {1, 62}, {5, 52}, {5, 57}},
72+ {{CTX_NA, CTX_NA}, {12, 49}, {9, 50}, {6, 57}},
73+ {{CTX_NA, CTX_NA}, { -4, 73}, { -3, 70}, { -17, 73}},
74+ {{CTX_NA, CTX_NA}, {17, 50}, {10, 54}, {14, 57}},
75+ //24-39 Table9-14
76+ {{CTX_NA, CTX_NA}, {18, 64}, {26, 34}, {20, 40}},
77+ {{CTX_NA, CTX_NA}, {9, 43}, {19, 22}, {20, 10}},
78+ {{CTX_NA, CTX_NA}, {29, 0}, {40, 0}, {29, 0}},
79+ {{CTX_NA, CTX_NA}, {26, 67}, {57, 2}, {54, 0}},
80+ {{CTX_NA, CTX_NA}, {16, 90}, {41, 36}, {37, 42}},
81+ {{CTX_NA, CTX_NA}, {9, 104}, {26, 69}, {12, 97}},
82+ {{CTX_NA, CTX_NA}, { -46, 127}, { -45, 127}, { -32, 127}},
83+ {{CTX_NA, CTX_NA}, { -20, 104}, { -15, 101}, { -22, 117}},
84+ {{CTX_NA, CTX_NA}, {1, 67}, { -4, 76}, { -2, 74}},
85+ {{CTX_NA, CTX_NA}, { -13, 78}, { -6, 71}, { -4, 85}},
86+ {{CTX_NA, CTX_NA}, { -11, 65}, { -13, 79}, { -24, 102}},
87+ {{CTX_NA, CTX_NA}, {1, 62}, {5, 52}, {5, 57}},
88+ {{CTX_NA, CTX_NA}, { -6, 86}, {6, 69}, { -6, 93}},
89+ {{CTX_NA, CTX_NA}, { -17, 95}, { -13, 90}, { -14, 88}},
90+ {{CTX_NA, CTX_NA}, { -6, 61}, {0, 52}, { -6, 44}},
91+ {{CTX_NA, CTX_NA}, {9, 45}, {8, 43}, {4, 55}},
92+ //40-53 Table 9-15
93+ {{CTX_NA, CTX_NA}, { -3, 69}, { -2, 69}, { -11, 89}},
94+ {{CTX_NA, CTX_NA}, { -6, 81}, { -5, 82}, { -15, 103}},
95+ {{CTX_NA, CTX_NA}, { -11, 96}, { -10, 96}, { -21, 116}},
96+ {{CTX_NA, CTX_NA}, {6, 55}, {2, 59}, {19, 57}},
97+ {{CTX_NA, CTX_NA}, {7, 67}, {2, 75}, {20, 58}},
98+ {{CTX_NA, CTX_NA}, { -5, 86}, { -3, 87}, {4, 84}},
99+ {{CTX_NA, CTX_NA}, {2, 88}, { -3, 100}, {6, 96}},
100+ {{CTX_NA, CTX_NA}, {0, 58}, {1, 56}, {1, 63}},
101+ {{CTX_NA, CTX_NA}, { -3, 76}, { -3, 74}, { -5, 85}},
102+ {{CTX_NA, CTX_NA}, { -10, 94}, { -6, 85}, { -13, 106}},
103+ {{CTX_NA, CTX_NA}, {5, 54}, {0, 59}, {5, 63}},
104+ {{CTX_NA, CTX_NA}, {4, 69}, { -3, 81}, {6, 75}},
105+ {{CTX_NA, CTX_NA}, { -3, 81}, { -7, 86}, { -3, 90}},
106+ {{CTX_NA, CTX_NA}, {0, 88}, { -5, 95}, { -1, 101}},
107+ //54-59 Table 9-16
108+ {{CTX_NA, CTX_NA}, { -7, 67}, { -1, 66}, {3, 55}},
109+ {{CTX_NA, CTX_NA}, { -5, 74}, { -1, 77}, { -4, 79}},
110+ {{CTX_NA, CTX_NA}, { -4, 74}, {1, 70}, { -2, 75}},
111+ {{CTX_NA, CTX_NA}, { -5, 80}, { -2, 86}, { -12, 97}},
112+ {{CTX_NA, CTX_NA}, { -7, 72}, { -5, 72}, { -7, 50}},
113+ {{CTX_NA, CTX_NA}, {1, 58}, {0, 61}, {1, 60}},
114+ //60-69 Table 9-17
115+ {{0, 41}, {0, 41}, {0, 41}, {0, 41}},
116+ {{0, 63}, {0, 63}, {0, 63}, {0, 63}},
117+ {{0, 63}, {0, 63}, {0, 63}, {0, 63}},
118+ {{0, 63}, {0, 63}, {0, 63}, {0, 63}},
119+ {{ -9, 83}, { -9, 83}, { -9, 83}, { -9, 83}},
120+ {{4, 86}, {4, 86}, {4, 86}, {4, 86}},
121+ {{0, 97}, {0, 97}, {0, 97}, {0, 97}},
122+ {{ -7, 72}, { -7, 72}, { -7, 72}, { -7, 72}},
123+ {{13, 41}, {13, 41}, {13, 41}, {13, 41}},
124+ {{3, 62}, {3, 62}, {3, 62}, {3, 62}},
125+ //70-104 Table 9-18
126+ {{0, 11}, {0, 45}, {13, 15}, {7, 34}},
127+ {{1, 55}, { -4, 78}, {7, 51}, { -9, 88}},
128+ {{0, 69}, { -3, 96}, {2, 80}, { -20, 127}},
129+ {{ -17, 127}, { -27, 126}, { -39, 127}, { -36, 127}},
130+ {{ -13, 102}, { -28, 98}, { -18, 91}, { -17, 91}},
131+ {{0, 82}, { -25, 101}, { -17, 96}, { -14, 95}},
132+ {{ -7, 74}, { -23, 67}, { -26, 81}, { -25, 84}},
133+ {{ -21, 107}, { -28, 82}, { -35, 98}, { -25, 86}},
134+ {{ -27, 127}, { -20, 94}, { -24, 102}, { -12, 89}},
135+ {{ -31, 127}, { -16, 83}, { -23, 97}, { -17, 91}},
136+ {{ -24, 127}, { -22, 110}, { -27, 119}, { -31, 127}},
137+ {{ -18, 95}, { -21, 91}, { -24, 99}, { -14, 76}},
138+ {{ -27, 127}, { -18, 102}, { -21, 110}, { -18, 103}},
139+ {{ -21, 114}, { -13, 93}, { -18, 102}, { -13, 90}},
140+ {{ -30, 127}, { -29, 127}, { -36, 127}, { -37, 127}},
141+ {{ -17, 123}, { -7, 92}, {0, 80}, {11, 80}},
142+ {{ -12, 115}, { -5, 89}, { -5, 89}, {5, 76}},
143+ {{ -16, 122}, { -7, 96}, { -7, 94}, {2, 84}},
144+ {{ -11, 115}, { -13, 108}, { -4, 92}, {5, 78}},
145+ {{ -12, 63}, { -3, 46}, {0, 39}, { -6, 55}},
146+ {{ -2, 68}, { -1, 65}, {0, 65}, {4, 61}},
147+ {{ -15, 84}, { -1, 57}, { -15, 84}, { -14, 83}},
148+ {{ -13, 104}, { -9, 93}, { -35, 127}, { -37, 127}},
149+ {{ -3, 70}, { -3, 74}, { -2, 73}, { -5, 79}},
150+ {{ -8, 93}, { -9, 92}, { -12, 104}, { -11, 104}},
151+ {{ -10, 90}, { -8, 87}, { -9, 91}, { -11, 91}},
152+ {{ -30, 127}, { -23, 126}, { -31, 127}, { -30, 127}},
153+ {{ -1, 74}, {5, 54}, {3, 55}, {0, 65}},
154+ {{ -6, 97}, {6, 60}, {7, 56}, { -2, 79}},
155+ {{ -7, 91}, {6, 59}, {7, 55}, {0, 72}},
156+ {{ -20, 127}, {6, 69}, {8, 61}, { -4, 92}},
157+ {{ -4, 56}, { -1, 48}, { -3, 53}, { -6, 56}},
158+ {{ -5, 82}, {0, 68}, {0, 68}, {3, 68}},
159+ {{ -7, 76}, { -4, 69}, { -7, 74}, { -8, 71}},
160+ {{ -22, 125}, { -8, 88}, { -9, 88}, { -13, 98}},
161+ //105-165 Table 9-19
162+ {{ -7, 93}, { -2, 85}, { -13, 103}, { -4, 86}},
163+ {{ -11, 87}, { -6, 78}, { -13, 91}, { -12, 88}},
164+ {{ -3, 77}, { -1, 75}, { -9, 89}, { -5, 82}},
165+ {{ -5, 71}, { -7, 77}, { -14, 92}, { -3, 72}},
166+ {{ -4, 63}, {2, 54}, { -8, 76}, { -4, 67}},
167+ {{ -4, 68}, {5, 50}, { -12, 87}, { -8, 72}},
168+ {{ -12, 84}, { -3, 68}, { -23, 110}, { -16, 89}},
169+ {{ -7, 62}, {1, 50}, { -24, 105}, { -9, 69}},
170+ {{ -7, 65}, {6, 42}, { -10, 78}, { -1, 59}},
171+ {{8, 61}, { -4, 81}, { -20, 112}, {5, 66}},
172+ {{5, 56}, {1, 63}, { -17, 99}, {4, 57}},
173+ {{ -2, 66}, { -4, 70}, { -78, 127}, { -4, 71}},
174+ {{1, 64}, {0, 67}, { -70, 127}, { -2, 71}},
175+ {{0, 61}, {2, 57}, { -50, 127}, {2, 58}},
176+ {{ -2, 78}, { -2, 76}, { -46, 127}, { -1, 74}},
177+ {{1, 50}, {11, 35}, { -4, 66}, { -4, 44}},
178+ {{7, 52}, {4, 64}, { -5, 78}, { -1, 69}},
179+ {{10, 35}, {1, 61}, { -4, 71}, {0, 62}},
180+ {{0, 44}, {11, 35}, { -8, 72}, { -7, 51}},
181+ {{11, 38}, {18, 25}, {2, 59}, { -4, 47}},
182+ {{1, 45}, {12, 24}, { -1, 55}, { -6, 42}},
183+ {{0, 46}, {13, 29}, { -7, 70}, { -3, 41}},
184+ {{5, 44}, {13, 36}, { -6, 75}, { -6, 53}},
185+ {{31, 17}, { -10, 93}, { -8, 89}, {8, 76}},
186+ {{1, 51}, { -7, 73}, { -34, 119}, { -9, 78}},
187+ {{7, 50}, { -2, 73}, { -3, 75}, { -11, 83}},
188+ {{28, 19}, {13, 46}, {32, 20}, {9, 52}},
189+ {{16, 33}, {9, 49}, {30, 22}, {0, 67}},
190+ {{14, 62}, { -7, 100}, { -44, 127}, { -5, 90}},
191+ {{ -13, 108}, {9, 53}, {0, 54}, {1, 67}},
192+ {{ -15, 100}, {2, 53}, { -5, 61}, { -15, 72}},
193+ {{ -13, 101}, {5, 53}, {0, 58}, { -5, 75}},
194+ {{ -13, 91}, { -2, 61}, { -1, 60}, { -8, 80}},
195+ {{ -12, 94}, {0, 56}, { -3, 61}, { -21, 83}},
196+ {{ -10, 88}, {0, 56}, { -8, 67}, { -21, 64}},
197+ {{ -16, 84}, { -13, 63}, { -25, 84}, { -13, 31}},
198+ {{ -10, 86}, { -5, 60}, { -14, 74}, { -25, 64}},
199+ {{ -7, 83}, { -1, 62}, { -5, 65}, { -29, 94}},
200+ {{ -13, 87}, {4, 57}, {5, 52}, {9, 75}},
201+ {{ -19, 94}, { -6, 69}, {2, 57}, {17, 63}},
202+ {{1, 70}, {4, 57}, {0, 61}, { -8, 74}},
203+ {{0, 72}, {14, 39}, { -9, 69}, { -5, 35}},
204+ {{ -5, 74}, {4, 51}, { -11, 70}, { -2, 27}},
205+ {{18, 59}, {13, 68}, {18, 55}, {13, 91}},
206+ {{ -8, 102}, {3, 64}, { -4, 71}, {3, 65}},
207+ {{ -15, 100}, {1, 61}, {0, 58}, { -7, 69}},
208+ {{0, 95}, {9, 63}, {7, 61}, {8, 77}},
209+ {{ -4, 75}, {7, 50}, {9, 41}, { -10, 66}},
210+ {{2, 72}, {16, 39}, {18, 25}, {3, 62}},
211+ {{ -11, 75}, {5, 44}, {9, 32}, { -3, 68}},
212+ {{ -3, 71}, {4, 52}, {5, 43}, { -20, 81}},
213+ {{15, 46}, {11, 48}, {9, 47}, {0, 30}},
214+ {{ -13, 69}, { -5, 60}, {0, 44}, {1, 7}},
215+ {{0, 62}, { -1, 59}, {0, 51}, { -3, 23}},
216+ {{0, 65}, {0, 59}, {2, 46}, { -21, 74}},
217+ {{21, 37}, {22, 33}, {19, 38}, {16, 66}},
218+ {{ -15, 72}, {5, 44}, { -4, 66}, { -23, 124}},
219+ {{9, 57}, {14, 43}, {15, 38}, {17, 37}},
220+ {{16, 54}, { -1, 78}, {12, 42}, {44, -18}},
221+ {{0, 62}, {0, 60}, {9, 34}, {50, -34}},
222+ {{12, 72}, {9, 69}, {0, 89}, { -22, 127}},
223+ //166-226 Table 9-20
224+ {{24, 0}, {11, 28}, {4, 45}, {4, 39}},
225+ {{15, 9}, {2, 40}, {10, 28}, {0, 42}},
226+ {{8, 25}, {3, 44}, {10, 31}, {7, 34}},
227+ {{13, 18}, {0, 49}, {33, -11}, {11, 29}},
228+ {{15, 9}, {0, 46}, {52, -43}, {8, 31}},
229+ {{13, 19}, {2, 44}, {18, 15}, {6, 37}},
230+ {{10, 37}, {2, 51}, {28, 0}, {7, 42}},
231+ {{12, 18}, {0, 47}, {35, -22}, {3, 40}},
232+ {{6, 29}, {4, 39}, {38, -25}, {8, 33}},
233+ {{20, 33}, {2, 62}, {34, 0}, {13, 43}},
234+ {{15, 30}, {6, 46}, {39, -18}, {13, 36}},
235+ {{4, 45}, {0, 54}, {32, -12}, {4, 47}},
236+ {{1, 58}, {3, 54}, {102, -94}, {3, 55}},
237+ {{0, 62}, {2, 58}, {0, 0}, {2, 58}},
238+ {{7, 61}, {4, 63}, {56, -15}, {6, 60}},
239+ {{12, 38}, {6, 51}, {33, -4}, {8, 44}},
240+ {{11, 45}, {6, 57}, {29, 10}, {11, 44}},
241+ {{15, 39}, {7, 53}, {37, -5}, {14, 42}},
242+ {{11, 42}, {6, 52}, {51, -29}, {7, 48}},
243+ {{13, 44}, {6, 55}, {39, -9}, {4, 56}},
244+ {{16, 45}, {11, 45}, {52, -34}, {4, 52}},
245+ {{12, 41}, {14, 36}, {69, -58}, {13, 37}},
246+ {{10, 49}, {8, 53}, {67, -63}, {9, 49}},
247+ {{30, 34}, { -1, 82}, {44, -5}, {19, 58}},
248+ {{18, 42}, {7, 55}, {32, 7}, {10, 48}},
249+ {{10, 55}, { -3, 78}, {55, -29}, {12, 45}},
250+ {{17, 51}, {15, 46}, {32, 1}, {0, 69}},
251+ {{17, 46}, {22, 31}, {0, 0}, {20, 33}},
252+ {{0, 89}, { -1, 84}, {27, 36}, {8, 63}},
253+ {{26, -19}, {25, 7}, {33, -25}, {35, -18}},
254+ {{22, -17}, {30, -7}, {34, -30}, {33, -25}},
255+ {{26, -17}, {28, 3}, {36, -28}, {28, -3}},
256+ {{30, -25}, {28, 4}, {38, -28}, {24, 10}},
257+ {{28, -20}, {32, 0}, {38, -27}, {27, 0}},
258+ {{33, -23}, {34, -1}, {34, -18}, {34, -14}},
259+ {{37, -27}, {30, 6}, {35, -16}, {52, -44}},
260+ {{33, -23}, {30, 6}, {34, -14}, {39, -24}},
261+ {{40, -28}, {32, 9}, {32, -8}, {19, 17}},
262+ {{38, -17}, {31, 19}, {37, -6}, {31, 25}},
263+ {{33, -11}, {26, 27}, {35, 0}, {36, 29}},
264+ {{40, -15}, {26, 30}, {30, 10}, {24, 33}},
265+ {{41, -6}, {37, 20}, {28, 18}, {34, 15}},
266+ {{38, 1}, {28, 34}, {26, 25}, {30, 20}},
267+ {{41, 17}, {17, 70}, {29, 41}, {22, 73}},
268+ {{30, -6}, {1, 67}, {0, 75}, {20, 34}},
269+ {{27, 3}, {5, 59}, {2, 72}, {19, 31}},
270+ {{26, 22}, {9, 67}, {8, 77}, {27, 44}},
271+ {{37, -16}, {16, 30}, {14, 35}, {19, 16}},
272+ {{35, -4}, {18, 32}, {18, 31}, {15, 36}},
273+ {{38, -8}, {18, 35}, {17, 35}, {15, 36}},
274+ {{38, -3}, {22, 29}, {21, 30}, {21, 28}},
275+ {{37, 3}, {24, 31}, {17, 45}, {25, 21}},
276+ {{38, 5}, {23, 38}, {20, 42}, {30, 20}},
277+ {{42, 0}, {18, 43}, {18, 45}, {31, 12}},
278+ {{35, 16}, {20, 41}, {27, 26}, {27, 16}},
279+ {{39, 22}, {11, 63}, {16, 54}, {24, 42}},
280+ {{14, 48}, {9, 59}, {7, 66}, {0, 93}},
281+ {{27, 37}, {9, 64}, {16, 56}, {14, 56}},
282+ {{21, 60}, { -1, 94}, {11, 73}, {15, 57}},
283+ {{12, 68}, { -2, 89}, {10, 67}, {26, 38}},
284+ {{2, 97}, { -9, 108}, { -10, 116}, { -24, 127}},
285+ //227-275 Table 9-21
286+ {{ -3, 71}, { -6, 76}, { -23, 112}, { -24, 115}},
287+ {{ -6, 42}, { -2, 44}, { -15, 71}, { -22, 82}},
288+ {{ -5, 50}, {0, 45}, { -7, 61}, { -9, 62}},
289+ {{ -3, 54}, {0, 52}, {0, 53}, {0, 53}},
290+ {{ -2, 62}, { -3, 64}, { -5, 66}, {0, 59}},
291+ {{0, 58}, { -2, 59}, { -11, 77}, { -14, 85}},
292+ {{1, 63}, { -4, 70}, { -9, 80}, { -13, 89}},
293+ {{ -2, 72}, { -4, 75}, { -9, 84}, { -13, 94}},
294+ {{ -1, 74}, { -8, 82}, { -10, 87}, { -11, 92}},
295+ {{ -9, 91}, { -17, 102}, { -34, 127}, { -29, 127}},
296+ {{ -5, 67}, { -9, 77}, { -21, 101}, { -21, 100}},
297+ {{ -5, 27}, {3, 24}, { -3, 39}, { -14, 57}},
298+ {{ -3, 39}, {0, 42}, { -5, 53}, { -12, 67}},
299+ {{ -2, 44}, {0, 48}, { -7, 61}, { -11, 71}},
300+ {{0, 46}, {0, 55}, { -11, 75}, { -10, 77}},
301+ {{ -16, 64}, { -6, 59}, { -15, 77}, { -21, 85}},
302+ {{ -8, 68}, { -7, 71}, { -17, 91}, { -16, 88}},
303+ {{ -10, 78}, { -12, 83}, { -25, 107}, { -23, 104}},
304+ {{ -6, 77}, { -11, 87}, { -25, 111}, { -15, 98}},
305+ {{ -10, 86}, { -30, 119}, { -28, 122}, { -37, 127}},
306+ {{ -12, 92}, {1, 58}, { -11, 76}, { -10, 82}},
307+ {{ -15, 55}, { -3, 29}, { -10, 44}, { -8, 48}},
308+ {{ -10, 60}, { -1, 36}, { -10, 52}, { -8, 61}},
309+ {{ -6, 62}, {1, 38}, { -10, 57}, { -8, 66}},
310+ {{ -4, 65}, {2, 43}, { -9, 58}, { -7, 70}},
311+ {{ -12, 73}, { -6, 55}, { -16, 72}, { -14, 75}},
312+ {{ -8, 76}, {0, 58}, { -7, 69}, { -10, 79}},
313+ {{ -7, 80}, {0, 64}, { -4, 69}, { -9, 83}},
314+ {{ -9, 88}, { -3, 74}, { -5, 74}, { -12, 92}},
315+ {{ -17, 110}, { -10, 90}, { -9, 86}, { -18, 108}},
316+ {{ -11, 97}, {0, 70}, {2, 66}, { -4, 79}},
317+ {{ -20, 84}, { -4, 29}, { -9, 34}, { -22, 69}},
318+ {{ -11, 79}, {5, 31}, {1, 32}, { -16, 75}},
319+ {{ -6, 73}, {7, 42}, {11, 31}, { -2, 58}},
320+ {{ -4, 74}, {1, 59}, {5, 52}, {1, 58}},
321+ {{ -13, 86}, { -2, 58}, { -2, 55}, { -13, 78}},
322+ {{ -13, 96}, { -3, 72}, { -2, 67}, { -9, 83}},
323+ {{ -11, 97}, { -3, 81}, {0, 73}, { -4, 81}},
324+ {{ -19, 117}, { -11, 97}, { -8, 89}, { -13, 99}},
325+ {{ -8, 78}, {0, 58}, {3, 52}, { -13, 81}},
326+ {{ -5, 33}, {8, 5}, {7, 4}, { -6, 38}},
327+ {{ -4, 48}, {10, 14}, {10, 8}, { -13, 62}},
328+ {{ -2, 53}, {14, 18}, {17, 8}, { -6, 58}},
329+ {{ -3, 62}, {13, 27}, {16, 19}, { -2, 59}},
330+ {{ -13, 71}, {2, 40}, {3, 37}, { -16, 73}},
331+ {{ -10, 79}, {0, 58}, { -1, 61}, { -10, 76}},
332+ {{ -12, 86}, { -3, 70}, { -5, 73}, { -13, 86}},
333+ {{ -13, 90}, { -6, 79}, { -1, 70}, { -9, 83}},
334+ {{ -14, 97}, { -8, 85}, { -4, 78}, { -10, 87}},
335+ //276 no use
336+ {{CTX_NA, CTX_NA}, {CTX_NA, CTX_NA}, {CTX_NA, CTX_NA}, {CTX_NA, CTX_NA}},
337+ //277-337 Table 9-22
338+ {{ -6, 93}, { -13, 106}, { -21, 126}, { -22, 127}},
339+ {{ -6, 84}, { -16, 106}, { -23, 124}, { -25, 127}},
340+ {{ -8, 79}, { -10, 87}, { -20, 110}, { -25, 120}},
341+ {{0, 66}, { -21, 114}, { -26, 126}, { -27, 127}},
342+ {{ -1, 71}, { -18, 110}, { -25, 124}, { -19, 114}},
343+ {{0, 62}, { -14, 98}, { -17, 105}, { -23, 117}},
344+ {{ -2, 60}, { -22, 110}, { -27, 121}, { -25, 118}},
345+ {{ -2, 59}, { -21, 106}, { -27, 117}, { -26, 117}},
346+ {{ -5, 75}, { -18, 103}, { -17, 102}, { -24, 113}},
347+ {{ -3, 62}, { -21, 107}, { -26, 117}, { -28, 118}},
348+ {{ -4, 58}, { -23, 108}, { -27, 116}, { -31, 120}},
349+ {{ -9, 66}, { -26, 112}, { -33, 122}, { -37, 124}},
350+ {{ -1, 79}, { -10, 96}, { -10, 95}, { -10, 94}},
351+ {{0, 71}, { -12, 95}, { -14, 100}, { -15, 102}},
352+ {{3, 68}, { -5, 91}, { -8, 95}, { -10, 99}},
353+ {{10, 44}, { -9, 93}, { -17, 111}, { -13, 106}},
354+ {{ -7, 62}, { -22, 94}, { -28, 114}, { -50, 127}},
355+ {{15, 36}, { -5, 86}, { -6, 89}, { -5, 92}},
356+ {{14, 40}, {9, 67}, { -2, 80}, {17, 57}},
357+ {{16, 27}, { -4, 80}, { -4, 82}, { -5, 86}},
358+ {{12, 29}, { -10, 85}, { -9, 85}, { -13, 94}},
359+ {{1, 44}, { -1, 70}, { -8, 81}, { -12, 91}},
360+ {{20, 36}, {7, 60}, { -1, 72}, { -2, 77}},
361+ {{18, 32}, {9, 58}, {5, 64}, {0, 71}},
362+ {{5, 42}, {5, 61}, {1, 67}, { -1, 73}},
363+ {{1, 48}, {12, 50}, {9, 56}, {4, 64}},
364+ {{10, 62}, {15, 50}, {0, 69}, { -7, 81}},
365+ {{17, 46}, {18, 49}, {1, 69}, {5, 64}},
366+ {{9, 64}, {17, 54}, {7, 69}, {15, 57}},
367+ {{ -12, 104}, {10, 41}, { -7, 69}, {1, 67}},
368+ {{ -11, 97}, {7, 46}, { -6, 67}, {0, 68}},
369+ {{ -16, 96}, { -1, 51}, { -16, 77}, { -10, 67}},
370+ {{ -7, 88}, {7, 49}, { -2, 64}, {1, 68}},
371+ {{ -8, 85}, {8, 52}, {2, 61}, {0, 77}},
372+ {{ -7, 85}, {9, 41}, { -6, 67}, {2, 64}},
373+ {{ -9, 85}, {6, 47}, { -3, 64}, {0, 68}},
374+ {{ -13, 88}, {2, 55}, {2, 57}, { -5, 78}},
375+ {{4, 66}, {13, 41}, { -3, 65}, {7, 55}},
376+ {{ -3, 77}, {10, 44}, { -3, 66}, {5, 59}},
377+ {{ -3, 76}, {6, 50}, {0, 62}, {2, 65}},
378+ {{ -6, 76}, {5, 53}, {9, 51}, {14, 54}},
379+ {{10, 58}, {13, 49}, { -1, 66}, {15, 44}},
380+ {{ -1, 76}, {4, 63}, { -2, 71}, {5, 60}},
381+ {{ -1, 83}, {6, 64}, { -2, 75}, {2, 70}},
382+ {{ -7, 99}, { -2, 69}, { -1, 70}, { -2, 76}},
383+ {{ -14, 95}, { -2, 59}, { -9, 72}, { -18, 86}},
384+ {{2, 95}, {6, 70}, {14, 60}, {12, 70}},
385+ {{0, 76}, {10, 44}, {16, 37}, {5, 64}},
386+ {{ -5, 74}, {9, 31}, {0, 47}, { -12, 70}},
387+ {{0, 70}, {12, 43}, {18, 35}, {11, 55}},
388+ {{ -11, 75}, {3, 53}, {11, 37}, {5, 56}},
389+ {{1, 68}, {14, 34}, {12, 41}, {0, 69}},
390+ {{0, 65}, {10, 38}, {10, 41}, {2, 65}},
391+ {{ -14, 73}, { -3, 52}, {2, 48}, { -6, 74}},
392+ {{3, 62}, {13, 40}, {12, 41}, {5, 54}},
393+ {{4, 62}, {17, 32}, {13, 41}, {7, 54}},
394+ {{ -1, 68}, {7, 44}, {0, 59}, { -6, 76}},
395+ {{ -13, 75}, {7, 38}, {3, 50}, { -11, 82}},
396+ {{11, 55}, {13, 50}, {19, 40}, { -2, 77}},
397+ {{5, 64}, {10, 57}, {3, 66}, { -2, 77}},
398+ {{12, 70}, {26, 43}, {18, 50}, {25, 42}},
399+ //338-398 Table9-23
400+ {{15, 6}, {14, 11}, {19, -6}, {17, -13}},
401+ {{6, 19}, {11, 14}, {18, -6}, {16, -9}},
402+ {{7, 16}, {9, 11}, {14, 0}, {17, -12}},
403+ {{12, 14}, {18, 11}, {26, -12}, {27, -21}},
404+ {{18, 13}, {21, 9}, {31, -16}, {37, -30}},
405+ {{13, 11}, {23, -2}, {33, -25}, {41, -40}},
406+ {{13, 15}, {32, -15}, {33, -22}, {42, -41}},
407+ {{15, 16}, {32, -15}, {37, -28}, {48, -47}},
408+ {{12, 23}, {34, -21}, {39, -30}, {39, -32}},
409+ {{13, 23}, {39, -23}, {42, -30}, {46, -40}},
410+ {{15, 20}, {42, -33}, {47, -42}, {52, -51}},
411+ {{14, 26}, {41, -31}, {45, -36}, {46, -41}},
412+ {{14, 44}, {46, -28}, {49, -34}, {52, -39}},
413+ {{17, 40}, {38, -12}, {41, -17}, {43, -19}},
414+ {{17, 47}, {21, 29}, {32, 9}, {32, 11}},
415+ {{24, 17}, {45, -24}, {69, -71}, {61, -55}},
416+ {{21, 21}, {53, -45}, {63, -63}, {56, -46}},
417+ {{25, 22}, {48, -26}, {66, -64}, {62, -50}},
418+ {{31, 27}, {65, -43}, {77, -74}, {81, -67}},
419+ {{22, 29}, {43, -19}, {54, -39}, {45, -20}},
420+ {{19, 35}, {39, -10}, {52, -35}, {35, -2}},
421+ {{14, 50}, {30, 9}, {41, -10}, {28, 15}},
422+ {{10, 57}, {18, 26}, {36, 0}, {34, 1}},
423+ {{7, 63}, {20, 27}, {40, -1}, {39, 1}},
424+ {{ -2, 77}, {0, 57}, {30, 14}, {30, 17}},
425+ {{ -4, 82}, { -14, 82}, {28, 26}, {20, 38}},
426+ {{ -3, 94}, { -5, 75}, {23, 37}, {18, 45}},
427+ {{9, 69}, { -19, 97}, {12, 55}, {15, 54}},
428+ {{ -12, 109}, { -35, 125}, {11, 65}, {0, 79}},
429+ {{36, -35}, {27, 0}, {37, -33}, {36, -16}},
430+ {{36, -34}, {28, 0}, {39, -36}, {37, -14}},
431+ {{32, -26}, {31, -4}, {40, -37}, {37, -17}},
432+ {{37, -30}, {27, 6}, {38, -30}, {32, 1}},
433+ {{44, -32}, {34, 8}, {46, -33}, {34, 15}},
434+ {{34, -18}, {30, 10}, {42, -30}, {29, 15}},
435+ {{34, -15}, {24, 22}, {40, -24}, {24, 25}},
436+ {{40, -15}, {33, 19}, {49, -29}, {34, 22}},
437+ {{33, -7}, {22, 32}, {38, -12}, {31, 16}},
438+ {{35, -5}, {26, 31}, {40, -10}, {35, 18}},
439+ {{33, 0}, {21, 41}, {38, -3}, {31, 28}},
440+ {{38, 2}, {26, 44}, {46, -5}, {33, 41}},
441+ {{33, 13}, {23, 47}, {31, 20}, {36, 28}},
442+ {{23, 35}, {16, 65}, {29, 30}, {27, 47}},
443+ {{13, 58}, {14, 71}, {25, 44}, {21, 62}},
444+ {{29, -3}, {8, 60}, {12, 48}, {18, 31}},
445+ {{26, 0}, {6, 63}, {11, 49}, {19, 26}},
446+ {{22, 30}, {17, 65}, {26, 45}, {36, 24}},
447+ {{31, -7}, {21, 24}, {22, 22}, {24, 23}},
448+ {{35, -15}, {23, 20}, {23, 22}, {27, 16}},
449+ {{34, -3}, {26, 23}, {27, 21}, {24, 30}},
450+ {{34, 3}, {27, 32}, {33, 20}, {31, 29}},
451+ {{36, -1}, {28, 23}, {26, 28}, {22, 41}},
452+ {{34, 5}, {28, 24}, {30, 24}, {22, 42}},
453+ {{32, 11}, {23, 40}, {27, 34}, {16, 60}},
454+ {{35, 5}, {24, 32}, {18, 42}, {15, 52}},
455+ {{34, 12}, {28, 29}, {25, 39}, {14, 60}},
456+ {{39, 11}, {23, 42}, {18, 50}, {3, 78}},
457+ {{30, 29}, {19, 57}, {12, 70}, { -16, 123}},
458+ {{34, 26}, {22, 53}, {21, 54}, {21, 53}},
459+ {{29, 39}, {22, 61}, {14, 71}, {22, 56}},
460+ {{19, 66}, {11, 86}, {11, 83}, {25, 61}},
461+ {{31, 21}, {12, 40}, {25, 32}, {21, 33}},
462+ {{31, 31}, {11, 51}, {21, 49}, {19, 50}},
463+ {{25, 50}, {14, 59}, {21, 54}, {17, 61}},
464+ //402-459 Table 9-24
465+ {{ -17, 120}, { -4, 79}, { -5, 85}, { -3, 78}},
466+ {{ -20, 112}, { -7, 71}, { -6, 81}, { -8, 74}},
467+ {{ -18, 114}, { -5, 69}, { -10, 77}, { -9, 72}},
468+ {{ -11, 85}, { -9, 70}, { -7, 81}, { -10, 72}},
469+ {{ -15, 92}, { -8, 66}, { -17, 80}, { -18, 75}},
470+ {{ -14, 89}, { -10, 68}, { -18, 73}, { -12, 71}},
471+ {{ -26, 71}, { -19, 73}, { -4, 74}, { -11, 63}},
472+ {{ -15, 81}, { -12, 69}, { -10, 83}, { -5, 70}},
473+ {{ -14, 80}, { -16, 70}, { -9, 71}, { -17, 75}},
474+ {{0, 68}, { -15, 67}, { -9, 67}, { -14, 72}},
475+ {{ -14, 70}, { -20, 62}, { -1, 61}, { -16, 67}},
476+ {{ -24, 56}, { -19, 70}, { -8, 66}, { -8, 53}},
477+ {{ -23, 68}, { -16, 66}, { -14, 66}, { -14, 59}},
478+ {{ -24, 50}, { -22, 65}, {0, 59}, { -9, 52}},
479+ {{ -11, 74}, { -20, 63}, {2, 59}, { -11, 68}},
480+ {{23, -13}, {9, -2}, {17, -10}, {9, -2}},
481+ {{26, -13}, {26, -9}, {32, -13}, {30, -10}},
482+ {{40, -15}, {33, -9}, {42, -9}, {31, -4}},
483+ {{49, -14}, {39, -7}, {49, -5}, {33, -1}},
484+ {{44, 3}, {41, -2}, {53, 0}, {33, 7}},
485+ {{45, 6}, {45, 3}, {64, 3}, {31, 12}},
486+ {{44, 34}, {49, 9}, {68, 10}, {37, 23}},
487+ {{33, 54}, {45, 27}, {66, 27}, {31, 38}},
488+ {{19, 82}, {36, 59}, {47, 57}, {20, 64}},
489+ {{ -3, 75}, { -6, 66}, { -5, 71}, { -9, 71}},
490+ {{ -1, 23}, { -7, 35}, {0, 24}, { -7, 37}},
491+ {{1, 34}, { -7, 42}, { -1, 36}, { -8, 44}},
492+ {{1, 43}, { -8, 45}, { -2, 42}, { -11, 49}},
493+ {{0, 54}, { -5, 48}, { -2, 52}, { -10, 56}},
494+ {{ -2, 55}, { -12, 56}, { -9, 57}, { -12, 59}},
495+ {{0, 61}, { -6, 60}, { -6, 63}, { -8, 63}},
496+ {{1, 64}, { -5, 62}, { -4, 65}, { -9, 67}},
497+ {{0, 68}, { -8, 66}, { -4, 67}, { -6, 68}},
498+ {{ -9, 92}, { -8, 76}, { -7, 82}, { -10, 79}},
499+ {{ -14, 106}, { -5, 85}, { -3, 81}, { -3, 78}},
500+ {{ -13, 97}, { -6, 81}, { -3, 76}, { -8, 74}},
501+ {{ -15, 90}, { -10, 77}, { -7, 72}, { -9, 72}},
502+ {{ -12, 90}, { -7, 81}, { -6, 78}, { -10, 72}},
503+ {{ -18, 88}, { -17, 80}, { -12, 72}, { -18, 75}},
504+ {{ -10, 73}, { -18, 73}, { -14, 68}, { -12, 71}},
505+ {{ -9, 79}, { -4, 74}, { -3, 70}, { -11, 63}},
506+ {{ -14, 86}, { -10, 83}, { -6, 76}, { -5, 70}},
507+ {{ -10, 73}, { -9, 71}, { -5, 66}, { -17, 75}},
508+ {{ -10, 70}, { -9, 67}, { -5, 62}, { -14, 72}},
509+ {{ -10, 69}, { -1, 61}, {0, 57}, { -16, 67}},
510+ {{ -5, 66}, { -8, 66}, { -4, 61}, { -8, 53}},
511+ {{ -9, 64}, { -14, 66}, { -9, 60}, { -14, 59}},
512+ {{ -5, 58}, {0, 59}, {1, 54}, { -9, 52}},
513+ {{2, 59}, {2, 59}, {2, 58}, { -11, 68}},
514+ {{21, -10}, {21, -13}, {17, -10}, {9, -2}},
515+ {{24, -11}, {33, -14}, {32, -13}, {30, -10}},
516+ {{28, -8}, {39, -7}, {42, -9}, {31, -4}},
517+ {{28, -1}, {46, -2}, {49, -5}, {33, -1}},
518+ {{29, 3}, {51, 2}, {53, 0}, {33, 7}},
519+ {{29, 9}, {60, 6}, {64, 3}, {31, 12}},
520+ {{35, 20}, {61, 17}, {68, 10}, {37, 23}},
521+ {{29, 36}, {55, 34}, {66, 27}, {31, 38}},
522+ {{14, 67}, {42, 62}, {47, 57}, {20, 64}},
523+};
524+
525+/*Table 9-44 – Specification of rangeTabLPS depending on pStateIdx and qCodIRangeIdx */
526+
527+const uint8_t g_kuiCabacRangeLps[64][4] = {
528+ { 128, 176, 208, 240}, { 128, 167, 197, 227}, { 128, 158, 187, 216}, { 123, 150, 178, 205}, { 116, 142, 169, 195}, { 111, 135, 160, 185}, { 105, 128, 152, 175}, { 100, 122, 144, 166},
529+ { 95, 116, 137, 158}, { 90, 110, 130, 150}, { 85, 104, 123, 142}, { 81, 99, 117, 135}, { 77, 94, 111, 128}, { 73, 89, 105, 122}, { 69, 85, 100, 116}, { 66, 80, 95, 110},
530+ { 62, 76, 90, 104}, { 59, 72, 86, 99}, { 56, 69, 81, 94}, { 53, 65, 77, 89}, { 51, 62, 73, 85}, { 48, 59, 69, 80}, { 46, 56, 66, 76}, { 43, 53, 63, 72},
531+ { 41, 50, 59, 69}, { 39, 48, 56, 65}, { 37, 45, 54, 62}, { 35, 43, 51, 59}, { 33, 41, 48, 56}, { 32, 39, 46, 53}, { 30, 37, 43, 50}, { 29, 35, 41, 48},
532+ { 27, 33, 39, 45}, { 26, 31, 37, 43}, { 24, 30, 35, 41}, { 23, 28, 33, 39}, { 22, 27, 32, 37}, { 21, 26, 30, 35}, { 20, 24, 29, 33}, { 19, 23, 27, 31},
533+ { 18, 22, 26, 30}, { 17, 21, 25, 28}, { 16, 20, 23, 27}, { 15, 19, 22, 25}, { 14, 18, 21, 24}, { 14, 17, 20, 23}, { 13, 16, 19, 22}, { 12, 15, 18, 21},
534+ { 12, 14, 17, 20}, { 11, 14, 16, 19}, { 11, 13, 15, 18}, { 10, 12, 15, 17}, { 10, 12, 14, 16}, { 9, 11, 13, 15}, { 9, 11, 12, 14}, { 8, 10, 12, 14},
535+ { 8, 9, 11, 13}, { 7, 9, 11, 12}, { 7, 9, 10, 12}, { 7, 8, 10, 11}, { 6, 8, 9, 11}, { 6, 7, 9, 10}, { 6, 7, 8, 9}, { 2, 2, 2, 2}
536+};
537+
538+/*Table 9-45 – State transition table*/
539+
540+const uint8_t g_kuiStateTransTable[64][2] = {
541+
542+ {0, 1}, {0, 2}, {1, 3}, {2, 4}, {2, 5}, {4, 6}, {4, 7}, {5, 8}, {6, 9}, {7, 10},
543+
544+ {8, 11}, {9, 12}, {9, 13}, {11, 14}, {11, 15}, {12, 16}, {13, 17}, {13, 18}, {15, 19}, {15, 20},
545+
546+ {16, 21}, {16, 22}, {18, 23}, {18, 24}, {19, 25}, {19, 26}, {21, 27}, {21, 28}, {22, 29}, {22, 30},
547+
548+ {23, 31}, {24, 32}, {24, 33}, {25, 34}, {26, 35}, {26, 36}, {27, 37}, {27, 38}, {28, 39}, {29, 40},
549+
550+ {29, 41}, {30, 42}, {30, 43}, {30, 44}, {31, 45}, {32, 46}, {32, 47}, {33, 48}, {33, 49}, {33, 50},
551+
552+ {34, 51}, {34, 52}, {35, 53}, {35, 54}, {35, 55}, {36, 56}, {36, 57}, {36, 58}, {37, 59}, {37, 60},
553+
554+ {37, 61}, {38, 62}, {38, 62}, {63, 63}
555+
556+};
557+}//end of namespace
codec/encoder/core/src/encoder.cpp+3−2
@@ -152,8 +152,9 @@ void WelsInitBGDFunc (SWelsFuncPtrList* pFuncList, const bool kbEnableBackground · 151 unmodified lines
152152 * \param pEncCtx sWelsEncCtx*
153153 * \return successful - 0; otherwise none 0 for failed
154154 */
155−int32_t InitFunctionPointers (SWelsFuncPtrList* pFuncList, SWelsSvcCodingParam* pParam, uint32_t uiCpuFlag) {
155+int32_t InitFunctionPointers (sWelsEncCtx* pEncCtx, SWelsSvcCodingParam* pParam, uint32_t uiCpuFlag) {
156156 int32_t iReturn = ENC_RETURN_SUCCESS;
157+ SWelsFuncPtrList* pFuncList = pEncCtx->pFuncList;
157158 bool bScreenContent = (SCREEN_CONTENT_REAL_TIME == pParam->iUsageType);
158159
159160 /* Functionality utilization of CPU instructions dependency */
@@ -209,7 +210,7 @@ int32_t InitFunctionPointers (SWelsFuncPtrList* pFuncList, SWelsSvcCodingParam* · 49 unmodified lines
209210 /*init pixel average function*/
210211 /*get one column or row pixel when refinement*/
211212 WelsInitMcFuncs (pFuncList, uiCpuFlag);
212− InitCoeffFunc (pFuncList, uiCpuFlag);
213+ InitCoeffFunc (pFuncList,uiCpuFlag,pParam->iEntropyCodingModeFlag);
213214
214215 WelsInitEncodingFuncs (pFuncList, uiCpuFlag);
215216 WelsInitReconstructionFuncs (pFuncList, uiCpuFlag);
codec/encoder/core/src/encoder_ext.cpp+5−2
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454 #include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
5555 #include "slice_multi_threading.h"
5656 #include "measure_time.h"
57+#include "svc_set_mb_syn.h"
5758
5859 namespace WelsEnc {
5960
@@ -947,7 +948,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 887 unmodified lines
947948 }
948949
949950 // initialize pPps
950− WelsInitPps (pPps, pSps, pSubsetSps, iPpsId, true, bUseSubsetSps);
951+ WelsInitPps (pPps, pSps, pSubsetSps, iPpsId, true, bUseSubsetSps,pParam->iEntropyCodingModeFlag);
951952
952953 // Not using FMO in SVC coding so far, come back if need FMO
953954 {
@@ -2053,7 +2054,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 1099 unmodified lines
20532054 FreeMemorySvc (&pCtx);
20542055 return 1;
20552056 }
2056− InitFunctionPointers (pCtx->pFuncList, pCtx->pSvcParam, uiCpuFeatureFlags);
2057+ InitFunctionPointers (pCtx, pCtx->pSvcParam, uiCpuFeatureFlags);
20572058
20582059 pCtx->iActiveThreadsNum = pCodingParam->iCountThreadsNum;
20592060 pCtx->iMaxSliceCount = iSliceNum;
@@ -2067,6 +2068,8 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 7 unmodified lines
20672068 if (pCodingParam->iMultipleThreadIdc > 1)
20682069 iRet = CreateSliceThreads (pCtx);
20692070
2071+ if(pCodingParam->iEntropyCodingModeFlag)
2072+ WelsCabacInit (pCtx);
20702073 WelsRcInitModule (pCtx, pCtx->pSvcParam->iRCMode);
20712074
20722075 pCtx->pVpp = new CWelsPreProcess (pCtx);
codec/encoder/core/src/set_mb_syn_cabac.cpp+240−0
@@ -0,0 +1,240 @@
1+/*!
2+ * \copy
3+ * Copyright (c) 2009-2013, Cisco Systems
4+ * All rights reserved.
5+ *
6+ * Redistribution and use in source and binary forms, with or without
7+ * modification, are permitted provided that the following conditions
8+ * are met:
9+ *
10+ * * Redistributions of source code must retain the above copyright
11+ * notice, this list of conditions and the following disclaimer.
12+ *
13+ * * Redistributions in binary form must reproduce the above copyright
14+ * notice, this list of conditions and the following disclaimer in
15+ * the documentation and/or other materials provided with the
16+ * distribution.
17+ *
18+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+ * POSSIBILITY OF SUCH DAMAGE.
30+ *
31+ *
32+ * \file set_mb_syn_cabac.cpp
33+ *
34+ * \brief cabac coding engine
35+ *
36+ * \date 10/11/2014 Created
37+ *
38+ *************************************************************************************
39+ */
40+#include <string.h>
41+#include "typedefs.h"
42+#include "macros.h"
43+#include "wels_common_defs.h"
44+#include "set_mb_syn_cabac.h"
45+#include "encoder.h"
46+
47+namespace WelsEnc {
48+
49+
50+void WelsCabacInit (void* pCtx) {
51+ sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
52+ for (int32_t iModel = 0; iModel < 4; iModel++) {
53+ for (int32_t iQp = 0; iQp <= WELS_QP_MAX; iQp++)
54+ for (int32_t iIdx = 0; iIdx < WELS_CONTEXT_COUNT; iIdx++) {
55+ int32_t m = g_kiCabacGlobalContextIdx[iIdx][iModel][0];
56+ int32_t n = g_kiCabacGlobalContextIdx[iIdx][iModel][1];
57+ int32_t iPreCtxState = WELS_CLIP3 ((((m * iQp) >> 4) + n), 1, 126);
58+ uint8_t uiValMps = 0;
59+ uint8_t uiStateIdx = 0;
60+ if (iPreCtxState <= 63) {
61+ uiStateIdx = 63 - iPreCtxState;
62+ uiValMps = 0;
63+ } else {
64+ uiStateIdx = iPreCtxState - 64;
65+ uiValMps = 1;
66+ }
67+ pEncCtx->sWelsCabacContexts[iModel][iQp][iIdx].m_uiState = uiStateIdx;
68+ pEncCtx->sWelsCabacContexts[iModel][iQp][iIdx].m_uiValMps = uiValMps;
69+ }
70+ }
71+}
72+
73+void WelsCabacContextInit (void* pCtx, SCabacCtx* pCbCtx, int32_t iModel) {
74+ sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
75+ int32_t iIdx = pEncCtx->eSliceType == WelsCommon::I_SLICE ? 0 : iModel + 1;
76+ int32_t iQp = pEncCtx->iGlobalQp;
77+ memcpy (pCbCtx->m_sStateCtx, pEncCtx->sWelsCabacContexts[iIdx][iQp],
78+ WELS_CONTEXT_COUNT * sizeof (SStateCtx));
79+}
80+
81+void WelsCabacEncodeInit (SCabacCtx* pCbCtx, uint8_t* pBuf, uint8_t* pEnd) {
82+ pCbCtx->m_uiLow = 0;
83+ pCbCtx->m_uiRange = 510;
84+ pCbCtx->m_iBitsOutstanding = 0;
85+ pCbCtx->m_uData = 0;
86+ pCbCtx->m_uiBitsUsed = 0;
87+ pCbCtx->m_iFirstFlag = 1;
88+ pCbCtx->m_pBufStart = pBuf;
89+ pCbCtx->m_pBufEnd = pEnd;
90+ pCbCtx->m_pBufCur = pBuf;
91+ pCbCtx->m_uiBinCountsInNalUnits = 0;
92+}
93+
94+void WelsCabacPutBit (SCabacCtx* pCbCtx, uint32_t iValue) {
95+ if (pCbCtx->m_iFirstFlag != 0) {
96+ pCbCtx->m_iFirstFlag = 0;
97+ } else {
98+ pCbCtx->m_uData = (pCbCtx->m_uData << 1) | iValue;
99+ pCbCtx->m_uiBitsUsed++;
100+ }
101+ if (pCbCtx->m_iBitsOutstanding == 0) {
102+ while (pCbCtx->m_uiBitsUsed >= 8) {
103+ pCbCtx->m_uiBitsUsed -= 8;
104+ uint32_t uiByte = pCbCtx->m_uData >> (pCbCtx->m_uiBitsUsed);
105+ if (pCbCtx->m_uiBitsUsed == 0)
106+ pCbCtx->m_uData = 0;
107+ else
108+ pCbCtx->m_uData &= (uint32_t) ((0xFFFFFFFF) >> (32 - pCbCtx->m_uiBitsUsed));
109+ *pCbCtx->m_pBufCur ++ = uiByte;
110+ }
111+ } else {
112+
113+ while (pCbCtx->m_iBitsOutstanding > 0) {
114+ pCbCtx->m_uData = (pCbCtx->m_uData << 1) | (1 - iValue);
115+ pCbCtx->m_iBitsOutstanding--;
116+ pCbCtx->m_uiBitsUsed++;
117+ while (pCbCtx->m_uiBitsUsed >= 8) {
118+ pCbCtx->m_uiBitsUsed -= 8;
119+ uint32_t uiByte = pCbCtx->m_uData >> (pCbCtx->m_uiBitsUsed);
120+ if (pCbCtx->m_uiBitsUsed == 0)
121+ pCbCtx->m_uData = 0;
122+ else
123+ pCbCtx->m_uData &= (uint32_t) ((0xFFFFFFFF) >> (32 - pCbCtx->m_uiBitsUsed));
124+ *pCbCtx->m_pBufCur ++ = uiByte;
125+ }
126+ }
127+ }
128+}
129+void WelsCabacEncodeRenorm (SCabacCtx* pCbCtx) {
130+ while (pCbCtx->m_uiRange < 256) {
131+ if (pCbCtx->m_uiLow < 256) {
132+ WelsCabacPutBit (pCbCtx, 0);
133+ } else {
134+ if (pCbCtx->m_uiLow >= 512) {
135+ pCbCtx->m_uiLow -= 512;
136+ WelsCabacPutBit (pCbCtx, 1);
137+ } else {
138+ pCbCtx->m_uiLow -= 256;
139+ pCbCtx->m_iBitsOutstanding++;
140+ }
141+ }
142+ pCbCtx->m_uiRange <<= 1;
143+ pCbCtx->m_uiLow <<= 1;
144+ }
145+}
146+void WelsCabacEncodeDecision (SCabacCtx* pCbCtx, int32_t iCtx, uint32_t uiBin) {
147+ uint8_t uiState = pCbCtx->m_sStateCtx[iCtx].m_uiState;
148+ uint8_t uiValMps = pCbCtx->m_sStateCtx[iCtx].m_uiValMps;
149+ uint32_t uiRangeLps = g_kuiCabacRangeLps[uiState][ (pCbCtx->m_uiRange >> 6) & 3];
150+
151+ pCbCtx->m_uiRange -= uiRangeLps;
152+ if (uiBin != uiValMps) { //LPS
153+ pCbCtx->m_uiLow += pCbCtx->m_uiRange;
154+ pCbCtx->m_uiRange = uiRangeLps;
155+ if (uiState == 0)
156+ uiValMps = 1 - uiValMps;
157+ pCbCtx->m_sStateCtx[iCtx].m_uiState = g_kuiStateTransTable[uiState][0];
158+ pCbCtx->m_sStateCtx[iCtx].m_uiValMps = uiValMps;
159+ } else {
160+ pCbCtx->m_sStateCtx[iCtx].m_uiState = g_kuiStateTransTable[uiState][1];
161+ }
162+ WelsCabacEncodeRenorm (pCbCtx);
163+ pCbCtx->m_uiBinCountsInNalUnits++;
164+}
165+
166+void WelsCabacEncodeBypassOne (SCabacCtx* pCbCtx, uint32_t uiBin) {
167+ pCbCtx->m_uiLow <<= 1;
168+ if (uiBin) {
169+ pCbCtx->m_uiLow += pCbCtx->m_uiRange;
170+ }
171+ if (pCbCtx->m_uiLow >= 1024) {
172+ WelsCabacPutBit (pCbCtx, 1);
173+ pCbCtx->m_uiLow -= 1024;
174+ } else {
175+ if (pCbCtx->m_uiLow < 512)
176+ WelsCabacPutBit (pCbCtx, 0);
177+ else {
178+ pCbCtx->m_uiLow -= 512;
179+ pCbCtx->m_iBitsOutstanding++;
180+ }
181+ }
182+ pCbCtx->m_uiBinCountsInNalUnits++;
183+}
184+void WelsCabacEncodeTerminate (SCabacCtx* pCbCtx, uint32_t uiBin) {
185+ pCbCtx->m_uiRange -= 2;
186+ if (uiBin) {
187+ pCbCtx->m_uiLow += pCbCtx->m_uiRange;
188+ pCbCtx->m_uiRange = 2;
189+ WelsCabacEncodeRenorm (pCbCtx);
190+ WelsCabacPutBit (pCbCtx, ((pCbCtx->m_uiLow >> 9) & 1));
191+ int32_t iLastTwoBits = (((pCbCtx->m_uiLow >> 7) & 3) | 1);
192+ pCbCtx->m_uData = (pCbCtx->m_uData << 2) | iLastTwoBits;
193+ pCbCtx->m_uiBitsUsed += 2;
194+ } else {
195+ WelsCabacEncodeRenorm (pCbCtx);
196+ }
197+ pCbCtx->m_uiBinCountsInNalUnits++;
198+}
199+void WelsCabacEncodeUeBypass (SCabacCtx* pCbCtx, int32_t iExpBits, uint32_t uiVal) {
200+ int32_t iSufS = uiVal;
201+ int32_t iStopLoop = 0;
202+ int32_t k = iExpBits;
203+ do {
204+ if (iSufS >= (1 << k)) {
205+ WelsCabacEncodeBypassOne (pCbCtx, 1);
206+ iSufS = iSufS - (1 << k);
207+ k++;
208+ } else {
209+ WelsCabacEncodeBypassOne (pCbCtx, 0);
210+ while (k--)
211+ WelsCabacEncodeBypassOne (pCbCtx, (iSufS >> k) & 1);
212+ iStopLoop = 1;
213+ }
214+ } while (!iStopLoop);
215+}
216+
217+void WelsCabacEncodeFlush (SCabacCtx* pCbCtx) {
218+ WelsCabacEncodeTerminate (pCbCtx, 1);
219+ while (pCbCtx->m_uiBitsUsed > 0) {
220+ if (pCbCtx->m_uiBitsUsed > 8) {
221+ pCbCtx->m_uiBitsUsed -= 8;
222+ uint32_t uiByte = pCbCtx->m_uData >> (pCbCtx->m_uiBitsUsed);
223+ pCbCtx->m_uData &= (uint32_t) ((0xFFFFFFFF) >> (32 - pCbCtx->m_uiBitsUsed));
224+ *pCbCtx->m_pBufCur ++ = uiByte;
225+ } else {
226+ if (pCbCtx->m_uiBitsUsed == 8) {
227+ *pCbCtx->m_pBufCur ++ = pCbCtx->m_uData & 0xff;
228+ } else {
229+ *pCbCtx->m_pBufCur ++ = (pCbCtx->m_uData << (8 - pCbCtx->m_uiBitsUsed));
230+ }
231+ pCbCtx->m_uiBitsUsed = 0;
232+ }
233+ }
234+
235+}
236+
237+uint8_t* WelsCabacEncodeGetPtr (SCabacCtx* pCbCtx) {
238+ return pCbCtx->m_pBufCur;
239+}
240+}
codec/encoder/core/src/set_mb_syn_cavlc.cpp+52−2
@@ -38,7 +38,7 @@ · 37 unmodified lines
3838 *************************************************************************************
3939 */
4040
41−#include "set_mb_syn_cavlc.h"
41+#include "svc_set_mb_syn.h"
4242 #include "vlc_encoder.h"
4343 #include "cpu_core.h"
4444 #include "wels_const.h"
@@ -199,8 +199,47 @@ int32_t WriteBlockResidualCavlc (SWelsFuncPtrList* pFuncList, int16_t* pCoffLev · 154 unmodified lines
199199 return ENC_RETURN_SUCCESS;
200200 }
201201
202+void StashMBStatusCavlc (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice, int32_t iMbSkipRun) {
203+ SBitStringAux* pBs = (SBitStringAux*)pBuffer;
204+ pDss->pBsStackBufPtr = pBs->pBufPtr;
205+ pDss->uiBsStackCurBits = pBs->uiCurBits;
206+ pDss->iBsStackLeftBits = pBs->iLeftBits;
207+ pDss->uiLastMbQp = pSlice->uiLastMbQp;
208+ pDss->iMbSkipRunStack = iMbSkipRun;
209+}
210+int32_t StashPopMBStatusCavlc (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice) {
211+ SBitStringAux* pBs = (SBitStringAux*)pBuffer;
212+ pBs->pBufPtr = pDss->pBsStackBufPtr;
213+ pBs->uiCurBits = pDss->uiBsStackCurBits;
214+ pBs->iLeftBits = pDss->iBsStackLeftBits;
215+ pSlice->uiLastMbQp = pDss->uiLastMbQp;
216+ return pDss->iMbSkipRunStack;
217+}
218+void StashMBStatusCabac (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice, int32_t iMbSkipRun) {
219+ SCabacCtx* pCtx = (SCabacCtx*)pBuffer;
220+ memcpy (&pDss->sStoredCabac, pCtx, sizeof (SCabacCtx));
221+ pDss->uiLastMbQp = pSlice->uiLastMbQp;
222+ pDss->iMbSkipRunStack = iMbSkipRun;
223+}
224+int32_t StashPopMBStatusCabac (SDynamicSlicingStack* pDss, void* pBuffer, SSlice* pSlice) {
225+ SCabacCtx* pCtx = (SCabacCtx*)pBuffer;
226+ memcpy (pCtx, &pDss->sStoredCabac, sizeof (SCabacCtx));
227+ pSlice->uiLastMbQp = pDss->uiLastMbQp;
228+ return pDss->iMbSkipRunStack;
229+}
230+
231+void WelsWriteSliceEndSyn (SSlice* pSlice, bool bEntropyCodingModeFlag) {
232+ SBitStringAux* pBs = pSlice->pSliceBsa;
233+ if (bEntropyCodingModeFlag) {
234+ WelsCabacEncodeFlush (&pSlice->sCabacCtx);
235+ pBs->pBufPtr = WelsCabacEncodeGetPtr (&pSlice->sCabacCtx);
202236
203−void InitCoeffFunc (SWelsFuncPtrList* pFuncList, const uint32_t uiCpuFlag) {
237+ } else {
238+ BsRbspTrailingBits (pBs);
239+ BsFlush (pBs);
240+ }
241+}
242+void InitCoeffFunc (SWelsFuncPtrList* pFuncList, const uint32_t uiCpuFlag,int32_t iEntropyCodingModeFlag) {
204243 pFuncList->pfCavlcParamCal = CavlcParamCal_c;
205244
206245 #if defined(X86_ASM)
@@ -208,6 +247,17 @@ void InitCoeffFunc (SWelsFuncPtrList* pFuncList, const uint32_t uiCpuFlag) { · 1 unmodified line
208247 // pFuncList->pfCavlcParamCal = CavlcParamCal_sse2;
209248 }
210249 #endif
250+ if (iEntropyCodingModeFlag) {
251+ pFuncList->pfStashMBStatus = StashMBStatusCabac;
252+ pFuncList->pfStashPopMBStatus = StashPopMBStatusCabac;
253+ pFuncList->pfWelsSpatialWriteMbSyn = WelsSpatialWriteMbSynCabac;
254+ } else {
255+ pFuncList->pfStashMBStatus = StashMBStatusCavlc;
256+ pFuncList->pfStashPopMBStatus = StashPopMBStatusCavlc;
257+ pFuncList->pfWelsSpatialWriteMbSyn = WelsSpatialWriteMbSyn;
258+
259+ }
211260 }
212261
262+
213263 } // namespace WelsEnc
codec/encoder/core/src/svc_base_layer_md.cpp+2−1
@@ -1617,7 +1617,7 @@ bool WelsMdFirstIntraMode (void* pEnc, void* pMd, SMB* pCurMb, SMbCache* pMbCach · 1616 unmodified lines
16171617 //chroma
16181618 pWelsMd->iCostChroma = WelsMdIntraChroma (pFunc, pEncCtx->pCurDqLayer, pMbCache, pWelsMd->iLambda);
16191619 WelsIMbChromaEncode (pEncCtx, pCurMb, pMbCache); //add pEnc&rec to MD--2010.3.15
1620−
1620+ pCurMb->uiChromPredMode = pMbCache->uiChmaI8x8Mode;
16211621 pCurMb->pSadCost[0] = 0;
16221622 return true; //intra_mb_type is best
16231623 }
@@ -1806,6 +1806,7 @@ void WelsMdIntraSecondaryModesEnc (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* · 182 unmodified lines
18061806 //chroma
18071807 pWelsMd->iCostChroma = WelsMdIntraChroma (pFunc, pEncCtx->pCurDqLayer, pMbCache, pWelsMd->iLambda);
18081808 WelsIMbChromaEncode (pEncCtx, pCurMb, pMbCache); //add pEnc&rec to MD--2010.3.15
1809+ pCurMb->uiChromPredMode = pMbCache->uiChmaI8x8Mode;
18091810 pCurMb->pSadCost[0] = 0;
18101811 }
18111812
codec/encoder/core/src/svc_encode_slice.cpp+57−64
@@ -43,7 +43,7 @@ · 42 unmodified lines
4343 #include "svc_enc_golomb.h"
4444 #include "svc_base_layer_md.h"
4545 #include "svc_encode_mb.h"
46−#include "svc_set_mb_syn_cavlc.h"
46+#include "svc_set_mb_syn.h"
4747 #include "decode_mb_aux.h"
4848 #include "svc_mode_decision.h"
4949
@@ -270,6 +270,9 @@ void WelsSliceHeaderWrite (SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* pSli · 220 unmodified lines
270270 WriteRefPicMarking (pBs, pSliceHeader, pNalHead);
271271 }
272272
273+ if (pPps->bEntropyCodingModeFlag && pSliceHeader->eSliceType != I_SLICE) {
274+ BsWriteUE (pBs, pSlice->iCabacInitIdc);
275+ }
273276 BsWriteSE (pBs, pSliceHeader->iSliceQpDelta); /* pSlice qp delta */
274277
275278 if (pPps->bDeblockingFilterControlPresentFlag) {
@@ -338,6 +341,11 @@ void WelsSliceHeaderExtWrite (SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* p · 62 unmodified lines
338341 }
339342 // }
340343
344+
345+ if (pPps->bEntropyCodingModeFlag && pSliceHeader->eSliceType != I_SLICE) {
346+ BsWriteUE (pBs, pSlice->iCabacInitIdc);
347+ }
348+
341349 BsWriteSE (pBs, pSliceHeader->iSliceQpDelta); /* pSlice qp delta */
342350
343351 if (pPps->bDeblockingFilterControlPresentFlag) {
@@ -460,21 +468,7 @@ void OutputPMbWithoutConstructCsRsNoCopy (sWelsEncCtx* pCtx, SDqLayer* pDq, SSli · 116 unmodified lines
460468 pfIdctFour4x4 (pDecV, kiDecStrideChroma, pDecV, kiDecStrideChroma, pScaledTcoeff + 320);
461469 }
462470 }
463−inline void StashMBStatus (SDynamicSlicingStack* pDss, SBitStringAux* pBs, SSlice* pSlice, int32_t iMbSkipRun = 0) {
464− pDss->pBsStackBufPtr = pBs->pBufPtr;
465− pDss->uiBsStackCurBits = pBs->uiCurBits;
466− pDss->iBsStackLeftBits = pBs->iLeftBits;
467− pDss->uiLastMbQp = pSlice->uiLastMbQp;
468− pDss->iMbSkipRunStack = iMbSkipRun;
469−}
470−void StashPopMBStatus (SDynamicSlicingStack* pDss, SBitStringAux* pBs, SSlice* pSlice, int32_t* pMbSkipRun = 0) {
471− pBs->pBufPtr = pDss->pBsStackBufPtr;
472− pBs->uiCurBits = pDss->uiBsStackCurBits;
473− pBs->iLeftBits = pDss->iBsStackLeftBits;
474− pSlice->uiLastMbQp = pDss->uiLastMbQp;
475− if (pMbSkipRun)
476− *pMbSkipRun = pDss->iMbSkipRunStack;
477−}
471+
478472 void UpdateQpForOverflow (SMB* pCurMb, uint8_t kuiChromaQpIndexOffset) {
479473 pCurMb->uiLumaQp += DELTA_QP;
480474 pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];
@@ -501,8 +495,11 @@ int32_t WelsISliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd + encodin · 20 unmodified lines
501495 int32_t iEncReturn = ENC_RETURN_SUCCESS;
502496 SBitStringAux* pBs = pSlice->pSliceBsa;
503497 SDynamicSlicingStack sDss;
498+ if (pEncCtx->pSvcParam->iEntropyCodingModeFlag) {
499+ WelsInitSliceCabac (pEncCtx, pSlice);
500+ }
504501 for (; ;) {
505− StashMBStatus (&sDss, pBs, pSlice);
502+ pEncCtx->pFuncList->pfStashMBStatus (&sDss, pBs, pSlice, 0);
506503 iCurMbIdx = iNextMbIdx;
507504 pCurMb = &pMbList[ iCurMbIdx ];
508505
@@ -514,9 +511,10 @@ TRY_REENCODING: · 5 unmodified lines
514511 WelsMdIntraMb (pEncCtx, &sMd, pCurMb, pMbCache);
515512 UpdateNonZeroCountCache (pCurMb, pMbCache);
516513
517− iEncReturn = WelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
514+
515+ iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
518516 if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
519− StashPopMBStatus (&sDss, pBs, pSlice);
517+ pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
520518 UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
521519 goto TRY_REENCODING;
522520 }
@@ -562,12 +560,14 @@ int32_t WelsISliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd + · 39 unmodified lines
562560 SWelsMD sMd;
563561 SDynamicSlicingStack sDss;
564562 sDss.iStartPos = BsGetBitsPos (pBs);
565−
563+ if (pEncCtx->pSvcParam->iEntropyCodingModeFlag) {
564+ WelsInitSliceCabac (pEncCtx, pSlice);
565+ }
566566 for (; ;) {
567567 iCurMbIdx = iNextMbIdx;
568568 pCurMb = &pMbList[ iCurMbIdx ];
569569
570− StashMBStatus (&sDss, pBs, pSlice);
570+ pEncCtx->pFuncList->pfStashMBStatus (&sDss, pBs, pSlice, 0);
571571 pEncCtx->pFuncList->pfRc.pfWelsRcMbInit (pEncCtx, pCurMb, pSlice);
572572 // if already reaches the largest number of slices, set QPs to the upper bound
573573 if (pSlice->bDynamicSlicingSliceSizeCtrlFlag) {
@@ -581,9 +581,9 @@ TRY_REENCODING: · 7 unmodified lines
581581 WelsMdIntraMb (pEncCtx, &sMd, pCurMb, pMbCache);
582582 UpdateNonZeroCountCache (pCurMb, pMbCache);
583583
584− iEncReturn = WelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
584+ iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
585585 if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
586− StashPopMBStatus (&sDss, pBs, pSlice);
586+ pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
587587 UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
588588 goto TRY_REENCODING;
589589 }
@@ -593,7 +593,7 @@ TRY_REENCODING: · 3 unmodified lines
593593 sDss.iCurrentPos = BsGetBitsPos (pBs);
594594
595595 if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) { //islice
596− StashPopMBStatus (&sDss, pBs, pSlice);
596+ pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
597597 pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
598598 1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
599599 ++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
@@ -749,7 +749,7 @@ int32_t WelsCodeOneSlice (sWelsEncCtx* pEncCtx, const int32_t kiSliceIdx, const · 149 unmodified lines
749749 if (ENC_RETURN_SUCCESS != iEncReturn)
750750 return iEncReturn;
751751
752− BsRbspTrailingBits (pBs);
752+ WelsWriteSliceEndSyn (pCurSlice, pEncCtx->pSvcParam->iEntropyCodingModeFlag);
753753
754754 return ENC_RETURN_SUCCESS;
755755 }
@@ -942,7 +942,6 @@ int32_t WelsMdInterMbLoop (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pWelsMd, · 186 unmodified lines
942942 int32_t iNumMbCoded = 0;
943943 int32_t iNextMbIdx = kiSliceFirstMbXY;
944944 int32_t iCurMbIdx = -1;
945− int32_t iMbSkipRun = 0;
946945 const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
947946 const int32_t kiMvdInterTableStride = pEncCtx->iMvdCostTableStride;
948947 uint16_t* pMvdCostTable = &pEncCtx->pMvdCostTable[pEncCtx->iMvdCostTableSize];
@@ -950,8 +949,12 @@ int32_t WelsMdInterMbLoop (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pWelsMd, · 1 unmodified line
950949 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
951950 int32_t iEncReturn = ENC_RETURN_SUCCESS;
952951 SDynamicSlicingStack sDss;
952+ if (pEncCtx->pSvcParam->iEntropyCodingModeFlag) {
953+ WelsInitSliceCabac (pEncCtx, pSlice);
954+ }
955+ pSlice->iMbSkipRun = 0;
953956 for (;;) {
954− StashMBStatus (&sDss, pBs, pSlice, iMbSkipRun);
957+ pEncCtx->pFuncList->pfStashMBStatus (&sDss, pBs, pSlice, pSlice->iMbSkipRun);
955958 //point to current pMb
956959 iCurMbIdx = iNextMbIdx;
957960 pCurMb = &pMbList[ iCurMbIdx ];
@@ -979,23 +982,16 @@ TRY_REENCODING: · 21 unmodified lines
979982 UpdateNonZeroCountCache (pCurMb, pMbCache);
980983
981984 //step (6): begin to write bit stream; if the pSlice size is controlled, the writing may be skipped
982− if (IS_SKIP (pCurMb->uiMbType)) {
983− pCurMb->uiLumaQp = pSlice->uiLastMbQp;
984− pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];
985985
986− iMbSkipRun++;
987− } else {
988− BsWriteUE (pBs, iMbSkipRun);
989− iMbSkipRun = 0;
990− iEncReturn = WelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
991− if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
992− StashPopMBStatus (&sDss, pBs, pSlice, &iMbSkipRun);
993− UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
994− goto TRY_REENCODING;
995− }
996− if (ENC_RETURN_SUCCESS != iEncReturn)
997− return iEncReturn;
986+ iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
987+ if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
988+ pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
989+ UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
990+ goto TRY_REENCODING;
998991 }
992+ if (ENC_RETURN_SUCCESS != iEncReturn)
993+ return iEncReturn;
994+
999995
1000996 //step (7): reconstruct current MB
1001997 pCurMb->uiSliceIdc = kiSliceIdx;
@@ -1017,8 +1013,8 @@ TRY_REENCODING: · 15 unmodified lines
10171013 }
10181014 }
10191015
1020− if (iMbSkipRun) {
1021− BsWriteUE (pBs, iMbSkipRun);
1016+ if (pSlice->iMbSkipRun) {
1017+ BsWriteUE (pBs, pSlice->iMbSkipRun);
10221018 }
10231019
10241020 return iEncReturn;
@@ -1038,7 +1034,6 @@ int32_t WelsMdInterMbLoopOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice, · 13 unmodified lines
10381034 const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
10391035 int32_t iNextMbIdx = kiSliceFirstMbXY;
10401036 int32_t iCurMbIdx = -1;
1041− int32_t iMbSkipRun = 0;
10421037 const int32_t kiMvdInterTableStride = pEncCtx->iMvdCostTableStride;
10431038 uint16_t* pMvdCostTable = &pEncCtx->pMvdCostTable[pEncCtx->iMvdCostTableSize];
10441039 const int32_t kiSliceIdx = pSlice->uiSliceIdx;
@@ -1048,10 +1043,14 @@ int32_t WelsMdInterMbLoopOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice, · 3 unmodified lines
10481043
10491044 SDynamicSlicingStack sDss;
10501045 sDss.iStartPos = BsGetBitsPos (pBs);
1046+ if (pEncCtx->pSvcParam->iEntropyCodingModeFlag) {
1047+ WelsInitSliceCabac (pEncCtx, pSlice);
1048+ }
1049+ pSlice->iMbSkipRun = 0;
10511050 for (;;) {
10521051 //DYNAMIC_SLICING_ONE_THREAD - MultiD
10531052 //stack pBs pointer
1054− StashMBStatus (&sDss, pBs, pSlice, iMbSkipRun);
1053+ pEncCtx->pFuncList->pfStashMBStatus (&sDss, pBs, pSlice, pSlice->iMbSkipRun);
10551054
10561055 //point to current pMb
10571056 iCurMbIdx = iNextMbIdx;
@@ -1088,28 +1087,22 @@ TRY_REENCODING: · 30 unmodified lines
10881087
10891088 //step (6): begin to write bit stream; if the pSlice size is controlled, the writing may be skipped
10901089
1091− if (IS_SKIP (pCurMb->uiMbType)) {
1092− pCurMb->uiLumaQp = pSlice->uiLastMbQp;
1093− pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];
10941090
1095− iMbSkipRun++;
1096− } else {
1097− BsWriteUE (pBs, iMbSkipRun);
1098− iMbSkipRun = 0;
1099− iEncReturn = WelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
1100− if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
1101− StashPopMBStatus (&sDss, pBs, pSlice, &iMbSkipRun);
1102− UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
1103− goto TRY_REENCODING;
1104− }
1105− if (ENC_RETURN_SUCCESS != iEncReturn)
1106− return iEncReturn;
1091+
1092+ iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
1093+ if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND) {
1094+ pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
1095+ UpdateQpForOverflow (pCurMb, kuiChromaQpIndexOffset);
1096+ goto TRY_REENCODING;
11071097 }
1098+ if (ENC_RETURN_SUCCESS != iEncReturn)
1099+ return iEncReturn;
1100+
11081101
11091102 //DYNAMIC_SLICING_ONE_THREAD - MultiD
11101103 sDss.iCurrentPos = BsGetBitsPos (pBs);
11111104 if (DynSlcJudgeSliceBoundaryStepBack (pEncCtx, pSlice, pSliceCtx, pCurMb, &sDss)) {
1112− StashPopMBStatus (&sDss, pBs, pSlice, &iMbSkipRun);
1105+ pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pBs, pSlice);
11131106 pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = iCurMbIdx -
11141107 1; // update pLastCodedMbIdxOfPartition, need to -1 due to stepping back
11151108 ++ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId];
@@ -1139,8 +1132,8 @@ TRY_REENCODING: · 23 unmodified lines
11391132 }
11401133 }
11411134
1142− if (iMbSkipRun) {
1143− BsWriteUE (pBs, iMbSkipRun);
1135+ if (pSlice->iMbSkipRun) {
1136+ BsWriteUE (pBs, pSlice->iMbSkipRun);
11441137 }
11451138
11461139 return iEncReturn;
codec/encoder/core/src/svc_set_mb_syn_cabac.cpp+691−0
@@ -0,0 +1,691 @@
1+/*!
2+ * \copy
3+ * Copyright (c) 2009-2013, Cisco Systems
4+ * All rights reserved.
5+ *
6+ * Redistribution and use in source and binary forms, with or without
7+ * modification, are permitted provided that the following conditions
8+ * are met:
9+ *
10+ * * Redistributions of source code must retain the above copyright
11+ * notice, this list of conditions and the following disclaimer.
12+ *
13+ * * Redistributions in binary form must reproduce the above copyright
14+ * notice, this list of conditions and the following disclaimer in
15+ * the documentation and/or other materials provided with the
16+ * distribution.
17+ *
18+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+ * POSSIBILITY OF SUCH DAMAGE.
30+ *
31+ *
32+ * \file svc_set_mb_syn_cabac.cpp
33+ *
34+ * \brief wrtie cabac syntax
35+ *
36+ * \date 9/28/2014 Created
37+ *
38+ *************************************************************************************
39+ */
40+#include "svc_set_mb_syn.h"
41+#include "set_mb_syn_cabac.h"
42+#include "svc_enc_golomb.h"
43+
44+namespace WelsEnc {
45+
46+static const uint16_t uiSignificantCoeffFlagOffset[5] = {0, 15, 29, 44, 47};
47+static const uint16_t uiLastCoeffFlagOffset[5] = {0, 15, 29, 44, 47};
48+static const uint16_t uiCoeffAbsLevelMinus1Offset[5] = {0, 10, 20, 30, 39};
49+static const uint16_t uiCodecBlockFlagOffset[5] = {0, 4, 8, 12, 16};
50+
51+
52+static void WelsCabacMbType (SCabacCtx* pCabacCtx, SMB* pCurMb, SMbCache* pMbCache, int32_t iMbWidth,
53+ EWelsSliceType eSliceType) {
54+
55+ if (eSliceType == I_SLICE) {
56+ uint32_t uiNeighborAvail = pCurMb->uiNeighborAvail;
57+ SMB* pLeftMb = pCurMb - 1 ;
58+ SMB* pTopMb = pCurMb - iMbWidth;
59+ int32_t iCtx = 3;
60+ if ((uiNeighborAvail & LEFT_MB_POS) && !IS_INTRA4x4 (pLeftMb->uiMbType))
61+ iCtx++;
62+ if ((uiNeighborAvail & TOP_MB_POS) && !IS_INTRA4x4 (pTopMb->uiMbType)) //TOP MB
63+ iCtx++;
64+
65+ if (pCurMb->uiMbType == MB_TYPE_INTRA4x4) {
66+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 0);
67+ } else {
68+ int32_t iCbpChroma = pCurMb->uiCbp >> 4;
69+ int32_t iCbpLuma = pCurMb->uiCbp & 15;
70+ int32_t iPredMode = g_kiMapModeI16x16[pMbCache->uiLumaI16x16Mode];
71+
72+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 1);
73+ WelsCabacEncodeTerminate (pCabacCtx, 0);
74+ if (iCbpLuma)
75+ WelsCabacEncodeDecision (pCabacCtx, 6, 1);
76+ else
77+ WelsCabacEncodeDecision (pCabacCtx, 6, 0);
78+
79+ if (iCbpChroma == 0)
80+ WelsCabacEncodeDecision (pCabacCtx, 7, 0);
81+ else {
82+ WelsCabacEncodeDecision (pCabacCtx, 7, 1);
83+ WelsCabacEncodeDecision (pCabacCtx, 8, iCbpChroma >> 1);
84+ }
85+ WelsCabacEncodeDecision (pCabacCtx, 9, iPredMode >> 1);
86+ WelsCabacEncodeDecision (pCabacCtx, 10, iPredMode & 1);
87+ }
88+ } else if (eSliceType == P_SLICE) {
89+ uint32_t uiMbType = pCurMb->uiMbType;
90+ if (uiMbType == MB_TYPE_16x16) {
91+ WelsCabacEncodeDecision (pCabacCtx, 14, 0);
92+ WelsCabacEncodeDecision (pCabacCtx, 15, 0);
93+ WelsCabacEncodeDecision (pCabacCtx, 16, 0);
94+ } else if ((uiMbType == MB_TYPE_16x8) || (uiMbType == MB_TYPE_8x16)) {
95+
96+ WelsCabacEncodeDecision (pCabacCtx, 14, 0);
97+ WelsCabacEncodeDecision (pCabacCtx, 15, 1);
98+ WelsCabacEncodeDecision (pCabacCtx, 17, pCurMb->uiMbType == MB_TYPE_16x8);
99+
100+ } else if ((uiMbType == MB_TYPE_8x8) || (uiMbType == MB_TYPE_8x8_REF0)) {
101+ WelsCabacEncodeDecision (pCabacCtx, 14, 0);
102+ WelsCabacEncodeDecision (pCabacCtx, 15, 0);
103+ WelsCabacEncodeDecision (pCabacCtx, 16, 1);
104+ } else if (pCurMb->uiMbType == MB_TYPE_INTRA4x4) {
105+ WelsCabacEncodeDecision (pCabacCtx, 14, 1);
106+ WelsCabacEncodeDecision (pCabacCtx, 17, 0);
107+ } else {
108+
109+ int32_t iCbpChroma = pCurMb->uiCbp >> 4;
110+ int32_t iCbpLuma = pCurMb->uiCbp & 15;
111+ int32_t iPredMode = g_kiMapModeI16x16[pMbCache->uiLumaI16x16Mode];
112+ //prefix
113+ WelsCabacEncodeDecision (pCabacCtx, 14, 1);
114+
115+ //suffix
116+ WelsCabacEncodeDecision (pCabacCtx, 17, 1);
117+ WelsCabacEncodeTerminate (pCabacCtx, 0);
118+ if (iCbpLuma)
119+ WelsCabacEncodeDecision (pCabacCtx, 18, 1);
120+ else
121+ WelsCabacEncodeDecision (pCabacCtx, 18, 0);
122+ if (iCbpChroma == 0)
123+ WelsCabacEncodeDecision (pCabacCtx, 19, 0);
124+ else {
125+ WelsCabacEncodeDecision (pCabacCtx, 19, 1);
126+ WelsCabacEncodeDecision (pCabacCtx, 19, iCbpChroma >> 1);
127+ }
128+ WelsCabacEncodeDecision (pCabacCtx, 20, iPredMode >> 1);
129+ WelsCabacEncodeDecision (pCabacCtx, 20, iPredMode & 1);
130+
131+ }
132+ }
133+
134+}
135+void WelsCabacMbIntra4x4PredMode (SCabacCtx* pCabacCtx, SMbCache* pMbCache) {
136+
137+ for (int32_t iMode = 0; iMode < 16; iMode++) {
138+
139+ bool bPredFlag = pMbCache->pPrevIntra4x4PredModeFlag[iMode];
140+ int8_t iRemMode = pMbCache->pRemIntra4x4PredModeFlag[iMode];
141+
142+ if (bPredFlag)
143+ WelsCabacEncodeDecision (pCabacCtx, 68, 1);
144+ else {
145+ WelsCabacEncodeDecision (pCabacCtx, 68, 0);
146+
147+ WelsCabacEncodeDecision (pCabacCtx, 69, iRemMode & 0x01);
148+ WelsCabacEncodeDecision (pCabacCtx, 69, (iRemMode >> 1) & 0x01);
149+ WelsCabacEncodeDecision (pCabacCtx, 69, (iRemMode >> 2));
150+ }
151+ }
152+}
153+
154+void WelsCabacMbIntraChromaPredMode (SCabacCtx* pCabacCtx, SMB* pCurMb, SMbCache* pMbCache, int32_t iMbWidth) {
155+ uint32_t uiNeighborAvail = pCurMb->uiNeighborAvail;
156+ SMB* pLeftMb = pCurMb - 1 ;
157+ SMB* pTopMb = pCurMb - iMbWidth;
158+
159+ int32_t iPredMode = g_kiMapModeIntraChroma[pMbCache->uiChmaI8x8Mode];
160+ int32_t iCtx = 64;
161+ if ((uiNeighborAvail & LEFT_MB_POS) && g_kiMapModeIntraChroma[pLeftMb->uiChromPredMode] != 0)
162+ iCtx++;
163+ if ((uiNeighborAvail & TOP_MB_POS) && g_kiMapModeIntraChroma[pTopMb->uiChromPredMode] != 0)
164+ iCtx++;
165+
166+ if (iPredMode == 0) {
167+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 0);
168+ } else if (iPredMode == 1) {
169+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 1);
170+ WelsCabacEncodeDecision (pCabacCtx, 67, 0);
171+ } else if (iPredMode == 2) {
172+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 1);
173+ WelsCabacEncodeDecision (pCabacCtx, 67, 1);
174+ WelsCabacEncodeDecision (pCabacCtx, 67, 0);
175+ } else {
176+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 1);
177+ WelsCabacEncodeDecision (pCabacCtx, 67, 1);
178+ WelsCabacEncodeDecision (pCabacCtx, 67, 1);
179+ }
180+}
181+
182+void WelsCabacMbCbp (SMB* pCurMb, int32_t iMbWidth, SCabacCtx* pCabacCtx) {
183+ int32_t iCbpBlockLuma[4] = { (pCurMb->uiCbp) & 1, (pCurMb->uiCbp >> 1) & 1, (pCurMb->uiCbp >> 2) & 1, (pCurMb->uiCbp >> 3) & 1};
184+ int32_t iCbpChroma = pCurMb->uiCbp >> 4;
185+ int32_t iCbpBlockLeft[4] = {0, 0, 0, 0};
186+ int32_t iCbpBlockTop[4] = {0, 0, 0, 0};
187+ int32_t iCbpLeftChroma = 0;
188+ int32_t iCbpTopChroma = 0;
189+ int32_t iCbp = 0;
190+ int32_t iCtx = 0;
191+ uint32_t uiNeighborAvail = pCurMb->uiNeighborAvail;
192+ if (uiNeighborAvail & LEFT_MB_POS) {
193+ iCbp = (pCurMb - 1)->uiCbp;
194+ iCbpBlockLeft[0] = ! (iCbp & 1);
195+ iCbpBlockLeft[1] = ! ((iCbp >> 1) & 1);
196+ iCbpBlockLeft[2] = ! ((iCbp >> 2) & 1);
197+ iCbpBlockLeft[3] = ! ((iCbp >> 3) & 1);
198+ iCbpLeftChroma = iCbp >> 4;
199+ if (iCbpLeftChroma)
200+ iCtx += 1;
201+ }
202+ if (uiNeighborAvail & TOP_MB_POS) {
203+ iCbp = (pCurMb - iMbWidth)->uiCbp;
204+ iCbpBlockTop[0] = ! (iCbp & 1);
205+ iCbpBlockTop[1] = ! ((iCbp >> 1) & 1);
206+ iCbpBlockTop[2] = ! ((iCbp >> 2) & 1);
207+ iCbpBlockTop[3] = ! ((iCbp >> 3) & 1);
208+ iCbpTopChroma = iCbp >> 4;
209+ if (iCbpTopChroma)
210+ iCtx += 2;
211+ }
212+ WelsCabacEncodeDecision (pCabacCtx, 73 + iCbpBlockLeft[1] + iCbpBlockTop[2] * 2, iCbpBlockLuma[0]);
213+ WelsCabacEncodeDecision (pCabacCtx, 73 + !iCbpBlockLuma[0] + iCbpBlockTop[3] * 2, iCbpBlockLuma[1]);
214+ WelsCabacEncodeDecision (pCabacCtx, 73 + iCbpBlockLeft[3] + (!iCbpBlockLuma[0]) * 2 , iCbpBlockLuma[2]);
215+ WelsCabacEncodeDecision (pCabacCtx, 73 + !iCbpBlockLuma[2] + (!iCbpBlockLuma[1]) * 2, iCbpBlockLuma[3]);
216+
217+
218+ //chroma
219+ if (iCbpChroma) {
220+ WelsCabacEncodeDecision (pCabacCtx, 77 + iCtx, 1);
221+ WelsCabacEncodeDecision (pCabacCtx, 81 + (iCbpLeftChroma >> 1) + ((iCbpTopChroma >> 1) * 2), iCbpChroma > 1);
222+ } else {
223+ WelsCabacEncodeDecision (pCabacCtx, 77 + iCtx, 0);
224+ }
225+}
226+
227+void WelsCabacMbDeltaQp (SMB* pCurMb, SCabacCtx* pCabacCtx) {
228+ SMB* pPrevMb = NULL;
229+ int32_t iCtx = 0;
230+ uint32_t uiNeighborAvail = pCurMb->uiNeighborAvail;
231+
232+ if ((uiNeighborAvail & LEFT_MB_POS) || (uiNeighborAvail & TOP_MB_POS)) {
233+ pPrevMb = pCurMb - 1;
234+ pCurMb->iLumaDQp = pCurMb->uiLumaQp - pPrevMb->uiLumaQp;
235+
236+ if (IS_SKIP (pPrevMb->uiMbType) || ((pPrevMb->uiMbType != MB_TYPE_INTRA16x16) && (!pPrevMb->uiCbp))
237+ || (!pPrevMb->iLumaDQp))
238+ iCtx = 0;
239+ else
240+ iCtx = 1;
241+ }
242+
243+ if (pCurMb->iLumaDQp) {
244+ int32_t iValue = pCurMb->iLumaDQp < 0 ? (-2 * pCurMb->iLumaDQp) : (2 * pCurMb->iLumaDQp - 1);
245+ WelsCabacEncodeDecision (pCabacCtx, 60 + iCtx, 1);
246+ if (iValue == 1) {
247+ WelsCabacEncodeDecision (pCabacCtx, 60 + 2, 0);
248+ } else {
249+ WelsCabacEncodeDecision (pCabacCtx, 60 + 2, 1);
250+ iValue--;
251+ while ((--iValue) > 0)
252+ WelsCabacEncodeDecision (pCabacCtx, 60 + 3, 1);
253+ WelsCabacEncodeDecision (pCabacCtx, 60 + 3, 0);
254+ }
255+ } else {
256+ WelsCabacEncodeDecision (pCabacCtx, 60 + iCtx, 0);
257+ }
258+}
259+
260+void WelsMbSkipCabac (SCabacCtx* pCabacCtx, SMB* pCurMb, int32_t iMbWidth, EWelsSliceType eSliceType,
261+ int16_t bSkipFlag) {
262+ int32_t iCtx = (eSliceType == P_SLICE) ? 11 : 24;
263+ uint32_t uiNeighborAvail = pCurMb->uiNeighborAvail;
264+ if (uiNeighborAvail & LEFT_MB_POS) { //LEFT MB
265+ if (!IS_SKIP ((pCurMb - 1)->uiMbType))
266+ iCtx++;
267+ }
268+ if (uiNeighborAvail & TOP_MB_POS) { //TOP MB
269+ if (!IS_SKIP ((pCurMb - iMbWidth)->uiMbType))
270+ iCtx++;
271+ }
272+ WelsCabacEncodeDecision (pCabacCtx, iCtx, bSkipFlag);
273+
274+ if (bSkipFlag) {
275+ for (int i = 0; i < 4; i++) {
276+
277+ pCurMb->sMvd[i].iMvX = 0;
278+ pCurMb->sMvd[i].iMvY = 0;
279+ }
280+ pCurMb->uiCbp = pCurMb->iCbpDc = 0;
281+ }
282+}
283+
284+void WelsCabacMbRef (SCabacCtx* pCabacCtx, SMB* pCurMb, SMbCache* pMbCache, int16_t iIdx) {
285+ SMVComponentUnit* pMvComp = &pMbCache->sMvComponents;
286+ const int16_t iRefIdxA = pMvComp->iRefIndexCache[iIdx + 6];
287+ const int16_t iRefIdxB = pMvComp->iRefIndexCache[iIdx + 1];
288+ int16_t iRefIdx = pMvComp->iRefIndexCache[iIdx + 7];
289+ int16_t iCtx = 0;
290+
291+ if ((iRefIdxA > 0) && (!pMbCache->bMbTypeSkip[3]))
292+ iCtx++;
293+ if ((iRefIdxB > 0) && (!pMbCache->bMbTypeSkip[1]))
294+ iCtx += 2;
295+
296+ while (iRefIdx > 0) {
297+ WelsCabacEncodeDecision (pCabacCtx, 54 + iCtx, 1);
298+ iCtx = (iCtx >> 2) + 4;
299+ iRefIdx--;
300+ }
301+ WelsCabacEncodeDecision (pCabacCtx, 54 + iCtx, 0);
302+}
303+
304+inline void WelsCabacMbMvdLx (SCabacCtx* pCabacCtx, int32_t sMvd, int32_t iCtx, int32_t iPredMvd) {
305+ const int32_t iAbsMvd = WELS_ABS (sMvd);
306+ int32_t iCtxInc = 0;
307+ int32_t iPrefix = WELS_MIN (iAbsMvd, 9);
308+ int32_t i = 0;
309+
310+ if (iPredMvd > 32)
311+ iCtxInc += 2;
312+ else if (iPredMvd > 2)
313+ iCtxInc += 1;
314+
315+ if (iPrefix) {
316+ if (iPrefix < 9) {
317+ WelsCabacEncodeDecision (pCabacCtx, iCtx + iCtxInc, 1);
318+ iCtxInc = 3;
319+ for (i = 0; i < iPrefix - 1; i++) {
320+ WelsCabacEncodeDecision (pCabacCtx, iCtx + iCtxInc, 1);
321+ if (i < 3)
322+ iCtxInc++;
323+ }
324+ WelsCabacEncodeDecision (pCabacCtx, iCtx + iCtxInc, 0);
325+ WelsCabacEncodeBypassOne (pCabacCtx, sMvd < 0);
326+ } else {
327+ WelsCabacEncodeDecision (pCabacCtx, iCtx + iCtxInc, 1);
328+ iCtxInc = 3;
329+ for (i = 0; i < (9 - 1); i++) {
330+ WelsCabacEncodeDecision (pCabacCtx, iCtx + iCtxInc, 1);
331+ if (i < 3)
332+ iCtxInc++;
333+ }
334+ WelsCabacEncodeUeBypass (pCabacCtx, 3, iAbsMvd - 9);
335+ WelsCabacEncodeBypassOne (pCabacCtx, sMvd < 0);
336+ }
337+ } else {
338+ WelsCabacEncodeDecision (pCabacCtx, iCtx + iCtxInc, 0);
339+ }
340+}
341+SMVUnitXY WelsCabacMbMvd (SCabacCtx* pCabacCtx, SMB* pCurMb, uint32_t iMbWidth,
342+ SMVUnitXY sCurMv, SMVUnitXY sPredMv, int16_t iBlockIdx) {
343+ uint32_t iAbsMvd0, iAbsMvd1;
344+ uint8_t uiNeighborAvail = pCurMb->uiNeighborAvail;
345+ SMVUnitXY sMvd;
346+ SMVUnitXY sMvdLeft;
347+ SMVUnitXY sMvdTop;
348+
349+ sMvdLeft.iMvX = sMvdLeft.iMvY = sMvdTop.iMvX = sMvdTop.iMvY = 0;
350+ sMvd.sDeltaMv (sCurMv, sPredMv);
351+
352+ if (((iBlockIdx == 0) || (iBlockIdx == 1)) && (uiNeighborAvail & TOP_MB_POS)) {
353+ sMvdTop.sAssginMv ((pCurMb - iMbWidth)->sMvd[iBlockIdx + 2]);
354+ }
355+ if ((iBlockIdx == 2) || (iBlockIdx == 3)) {
356+ sMvdTop.sAssginMv (pCurMb->sMvd[iBlockIdx - 2]);
357+ }
358+ if (((iBlockIdx == 0) || (iBlockIdx == 2)) && (uiNeighborAvail & LEFT_MB_POS)) {
359+ sMvdLeft.sAssginMv ((pCurMb - 1)->sMvd[iBlockIdx + 1]);
360+ }
361+ if ((iBlockIdx == 1) || (iBlockIdx == 3)) {
362+ sMvdLeft.sAssginMv (pCurMb->sMvd[iBlockIdx - 1]);
363+ }
364+
365+ iAbsMvd0 = WELS_ABS (sMvdLeft.iMvX) + WELS_ABS (sMvdTop.iMvX);
366+ iAbsMvd1 = WELS_ABS (sMvdLeft.iMvY) + WELS_ABS (sMvdTop.iMvY);
367+
368+ WelsCabacMbMvdLx (pCabacCtx, sMvd.iMvX, 40, iAbsMvd0);
369+ WelsCabacMbMvdLx (pCabacCtx, sMvd.iMvY, 47, iAbsMvd1);
370+ return sMvd;
371+}
372+
373+int16_t WelsGetMbCtxCabac (SMbCache* pMbCache, SMB* pCurMb, uint32_t iMbWidth, ECtxBlockCat eCtxBlockCat,
374+ int16_t iIdx) {
375+ int16_t iNzA = -1, iNzB = -1;
376+ int8_t* pNonZeroCoeffCount = pMbCache->iNonZeroCoeffCount;
377+ int32_t bIntra = IS_INTRA (pCurMb->uiMbType);
378+ int32_t iCtxInc = 0;
379+ switch (eCtxBlockCat) {
380+ case LUMA_AC:
381+ case CHROMA_AC:
382+ case LUMA_4x4:
383+ iNzA = pNonZeroCoeffCount[iIdx - 1];
384+ iNzB = pNonZeroCoeffCount[iIdx - 8];
385+ break;
386+ case LUMA_DC:
387+ case CHROMA_DC:
388+ if (pCurMb->uiNeighborAvail & LEFT_MB_POS)
389+ iNzA = (pCurMb - 1)->iCbpDc & (1 << iIdx);
390+ if (pCurMb->uiNeighborAvail & TOP_MB_POS)
391+ iNzB = (pCurMb - iMbWidth)->iCbpDc & (1 << iIdx);
392+ break;
393+ default:
394+ break;
395+ }
396+ if (((iNzA == -1) && bIntra) || (iNzA > 0))
397+ iCtxInc += 1;
398+ if (((iNzB == -1) && bIntra) || (iNzB > 0))
399+ iCtxInc += 2;
400+ return 85 + uiCodecBlockFlagOffset[eCtxBlockCat] + iCtxInc;
401+}
402+
403+void WelsWriteBlockResidualCabac (SMbCache* pMbCache, SMB* pCurMb, uint32_t iMbWidth, SCabacCtx* pCabacCtx,
404+ ECtxBlockCat eCtxBlockCat, int16_t iIdx, int16_t iNonZeroCount, int16_t* pBlock, int16_t iEndIdx) {
405+ int32_t iCtx = WelsGetMbCtxCabac (pMbCache, pCurMb, iMbWidth, eCtxBlockCat, iIdx);
406+ if (iNonZeroCount) {
407+ ENFORCE_STACK_ALIGN_1D (int16_t, iAbsLevel, 16, 16);
408+ ENFORCE_STACK_ALIGN_1D (int16_t, iSignLevel, 16, 16);
409+ const int32_t iCtxSig = 105 + uiSignificantCoeffFlagOffset[eCtxBlockCat];
410+ const int32_t iCtxLast = 166 + uiLastCoeffFlagOffset[eCtxBlockCat];
411+ const int32_t iCtxLevel = 227 + uiCoeffAbsLevelMinus1Offset[eCtxBlockCat];
412+ int32_t iNonZeroIdx = 0;
413+ int32_t i = 0;
414+ int32_t iNumAbsLevelEq1 = 0;
415+ int32_t iNumAbsLevelGt1 = 0;
416+
417+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 1);
418+ while (1) {
419+ if (pBlock[i]) {
420+ iSignLevel[iNonZeroIdx] = pBlock[i] < 0;
421+ iAbsLevel[iNonZeroIdx] = WELS_ABS (pBlock[i]) - 1;
422+
423+ iNonZeroIdx++;
424+ WelsCabacEncodeDecision (pCabacCtx, iCtxSig + i, 1);
425+ if (iNonZeroIdx != iNonZeroCount)
426+ WelsCabacEncodeDecision (pCabacCtx, iCtxLast + i, 0);
427+ else {
428+ WelsCabacEncodeDecision (pCabacCtx, iCtxLast + i, 1);
429+ break;
430+ }
431+ } else
432+ WelsCabacEncodeDecision (pCabacCtx, iCtxSig + i, 0);
433+ i++;
434+ if (i == iEndIdx) {
435+ iSignLevel[iNonZeroIdx] = pBlock[i] < 0;
436+ iAbsLevel[iNonZeroIdx] = WELS_ABS (pBlock[i]) - 1;
437+ iNonZeroIdx++;
438+ break;
439+ }
440+ }
441+ do {
442+ int32_t iPrefix = 0;
443+ iNonZeroIdx--;
444+ iPrefix = WELS_MIN (iAbsLevel[iNonZeroIdx], 14);
445+ if (iPrefix) {
446+ iCtx = iCtxLevel + ((iNumAbsLevelGt1 != 0) ? 0 : WELS_MIN (4, 1 + iNumAbsLevelEq1));
447+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 1);
448+ iCtx = iCtxLevel + 5 + WELS_MIN (4 - (eCtxBlockCat == CHROMA_DC), iNumAbsLevelGt1);
449+ for (i = 0; i < iPrefix - 1; i++)
450+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 1);
451+ if (iPrefix < 14)
452+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 0);
453+ else
454+ WelsCabacEncodeUeBypass (pCabacCtx, 0, iAbsLevel[iNonZeroIdx] - 14);
455+ iNumAbsLevelGt1++;
456+ } else {
457+ iCtx = iCtxLevel + ((iNumAbsLevelGt1 != 0) ? 0 : WELS_MIN (4, 1 + iNumAbsLevelEq1));
458+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 0);
459+ iNumAbsLevelEq1++;
460+ }
461+ WelsCabacEncodeBypassOne (pCabacCtx, iSignLevel[iNonZeroIdx]);
462+ } while (iNonZeroIdx > 0);
463+
464+ } else {
465+ WelsCabacEncodeDecision (pCabacCtx, iCtx, 0);
466+ }
467+
468+
469+}
470+int32_t WelsCalNonZeroCount (int16_t* pBlock, int16_t iNum) {
471+ int32_t iCount = 0;
472+ for (int16_t i = 0; i < iNum; i++) {
473+ if (pBlock[i])
474+ iCount++;
475+ }
476+ return iCount;
477+}
478+int32_t WelsWriteMbResidualCabac (SSlice* pSlice, SMbCache* sMbCacheInfo, SMB* pCurMb, SCabacCtx* pCabacCtx,
479+ int16_t iMbWidth, uint32_t uiChromaQpIndexOffset) {
480+
481+ const uint16_t uiMbType = pCurMb->uiMbType;
482+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
483+ int16_t i = 0;
484+ int8_t* pNonZeroCoeffCount = pMbCache->iNonZeroCoeffCount;
485+
486+
487+ pCurMb->iCbpDc = 0;
488+ pCurMb->iLumaDQp = 0;
489+
490+ if ((pCurMb->uiCbp > 0) || (uiMbType == MB_TYPE_INTRA16x16)) {
491+ int32_t iCbpChroma = pCurMb->uiCbp >> 4;
492+ int32_t iCbpLuma = pCurMb->uiCbp & 15;
493+
494+ pCurMb->iLumaDQp = pCurMb->uiLumaQp - pSlice->uiLastMbQp;
495+ WelsCabacMbDeltaQp (pCurMb, pCabacCtx);
496+ pSlice->uiLastMbQp = pCurMb->uiLumaQp;
497+
498+ if (uiMbType == MB_TYPE_INTRA16x16) {
499+ //Luma DC
500+ int iNonZeroCount = WelsCalNonZeroCount (pMbCache->pDct->iLumaI16x16Dc, 16);
501+ WelsWriteBlockResidualCabac (pMbCache, pCurMb, iMbWidth, pCabacCtx, LUMA_DC, 0, iNonZeroCount,
502+ pMbCache->pDct->iLumaI16x16Dc, 15);
503+ if (iNonZeroCount)
504+ pCurMb->iCbpDc |= 1;
505+ //Luma AC
506+
507+ if (iCbpLuma) {
508+ for (i = 0; i < 16; i++) {
509+ int32_t iIdx = g_kuiCache48CountScan4Idx[i];
510+ WelsWriteBlockResidualCabac (pMbCache, pCurMb, iMbWidth, pCabacCtx, LUMA_AC, iIdx,
511+ pNonZeroCoeffCount[iIdx], pMbCache->pDct->iLumaBlock[i], 14);
512+ }
513+ }
514+ } else {
515+ //Luma AC
516+ for (i = 0; i < 16; i++) {
517+ if (iCbpLuma & (1 << (i >> 2))) {
518+ int32_t iIdx = g_kuiCache48CountScan4Idx[i];
519+ WelsWriteBlockResidualCabac (pMbCache, pCurMb, iMbWidth, pCabacCtx, LUMA_4x4, iIdx,
520+ pNonZeroCoeffCount[iIdx], pMbCache->pDct->iLumaBlock[i], 15);
521+ }
522+
523+ }
524+ }
525+
526+ if (iCbpChroma) {
527+ int32_t iNonZeroCount = 0;
528+ //chroma DC
529+ iNonZeroCount = WelsCalNonZeroCount (pMbCache->pDct->iChromaDc[0], 4);
530+ if (iNonZeroCount)
531+ pCurMb->iCbpDc |= 0x2;
532+ WelsWriteBlockResidualCabac (pMbCache, pCurMb, iMbWidth, pCabacCtx, CHROMA_DC, 1, iNonZeroCount,
533+ pMbCache->pDct->iChromaDc[0], 3);
534+
535+ iNonZeroCount = WelsCalNonZeroCount (pMbCache->pDct->iChromaDc[1], 4);
536+ if (iNonZeroCount)
537+ pCurMb->iCbpDc |= 0x4;
538+ WelsWriteBlockResidualCabac (pMbCache, pCurMb, iMbWidth, pCabacCtx, CHROMA_DC, 2, iNonZeroCount,
539+ pMbCache->pDct->iChromaDc[1], 3);
540+ if (iCbpChroma & 0x02) {
541+ const uint8_t* g_kuiCache48CountScan4Idx_16base = &g_kuiCache48CountScan4Idx[16];
542+ //Cb AC
543+ for (i = 0; i < 4; i++) {
544+ int32_t iIdx = g_kuiCache48CountScan4Idx_16base[i];
545+ WelsWriteBlockResidualCabac (pMbCache, pCurMb, iMbWidth, pCabacCtx, CHROMA_AC, iIdx,
546+ pNonZeroCoeffCount[iIdx], pMbCache->pDct->iChromaBlock[i], 14);
547+
548+ }
549+
550+ //Cr AC
551+
552+ for (i = 0; i < 4; i++) {
553+ int32_t iIdx = 24 + g_kuiCache48CountScan4Idx_16base[i];
554+ WelsWriteBlockResidualCabac (pMbCache, pCurMb, iMbWidth, pCabacCtx, CHROMA_AC, iIdx,
555+ pNonZeroCoeffCount[iIdx], pMbCache->pDct->iChromaBlock[4 + i], 14);
556+ }
557+ }
558+ }
559+ } else {
560+ pCurMb->uiLumaQp = pSlice->uiLastMbQp;
561+ pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + uiChromaQpIndexOffset)];
562+ }
563+ return 0;
564+}
565+
566+void WelsInitSliceCabac (sWelsEncCtx* pEncCtx, SSlice* pSlice) {
567+ /* alignment needed */
568+ SBitStringAux* pBs = pSlice->pSliceBsa;
569+ BsAlign (pBs);
570+
571+ /* init cabac */
572+ WelsCabacContextInit (pEncCtx, &pSlice->sCabacCtx, pSlice->iCabacInitIdc);
573+ WelsCabacEncodeInit (&pSlice->sCabacCtx, pBs->pBufPtr, pBs->pBufEnd);
574+}
575+
576+int32_t WelsSpatialWriteMbSynCabac (void* pCtx, SSlice* pSlice, SMB* pCurMb) {
577+ sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
578+ SCabacCtx* pCabacCtx = &pSlice->sCabacCtx;
579+ SMbCache* pMbCache = &pSlice->sMbCacheInfo;
580+ const uint16_t uiMbType = pCurMb->uiMbType;
581+ SSliceHeaderExt* pSliceHeadExt = &pSlice->sSliceHeaderExt;
582+ uint32_t uiNumRefIdxL0Active = pSliceHeadExt->sSliceHeader.uiNumRefIdxL0Active - 1;
583+ const int32_t iSliceFirstMbXY = pSliceHeadExt->sSliceHeader.iFirstMbInSlice;
584+ int16_t i = 0;
585+ int16_t iMbWidth = pEncCtx->pCurDqLayer->iMbWidth;
586+ uint32_t uiChromaQpIndexOffset = pEncCtx->pCurDqLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
587+ SMVUnitXY sMvd;
588+ int32_t iRet = 0;
589+ if (pCurMb->iMbXY > iSliceFirstMbXY)
590+ WelsCabacEncodeTerminate (&pSlice->sCabacCtx, 0);
591+
592+ if (IS_SKIP (pCurMb->uiMbType)) {
593+ pCurMb->uiLumaQp = pSlice->uiLastMbQp;
594+ pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + uiChromaQpIndexOffset)];
595+ WelsMbSkipCabac (&pSlice->sCabacCtx, pCurMb, iMbWidth, pEncCtx->eSliceType, 1);
596+
597+ } else {
598+ //skip flag
599+ if (pEncCtx->eSliceType != I_SLICE)
600+ WelsMbSkipCabac (&pSlice->sCabacCtx, pCurMb, iMbWidth, pEncCtx->eSliceType, 0);
601+
602+ //write mb type
603+ WelsCabacMbType (pCabacCtx, pCurMb, pMbCache, iMbWidth, pEncCtx->eSliceType);
604+
605+ if (IS_INTRA (uiMbType)) {
606+ if (uiMbType == MB_TYPE_INTRA4x4) {
607+ WelsCabacMbIntra4x4PredMode (pCabacCtx, pMbCache);
608+ }
609+ WelsCabacMbIntraChromaPredMode (pCabacCtx, pCurMb, pMbCache, iMbWidth);
610+ sMvd.iMvX = sMvd.iMvY = 0;
611+ pCurMb->sMvd[0].sAssginMv (sMvd);
612+ pCurMb->sMvd[1].sAssginMv (sMvd);
613+ pCurMb->sMvd[2].sAssginMv (sMvd);
614+ pCurMb->sMvd[3].sAssginMv (sMvd);
615+
616+ } else if (uiMbType == MB_TYPE_16x16) {
617+
618+ if (uiNumRefIdxL0Active > 0) {
619+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 0);
620+ }
621+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[0], pMbCache->sMbMvp[0], 0);
622+
623+ pCurMb->sMvd[0].sAssginMv (sMvd);
624+ pCurMb->sMvd[1].sAssginMv (sMvd);
625+ pCurMb->sMvd[2].sAssginMv (sMvd);
626+ pCurMb->sMvd[3].sAssginMv (sMvd);
627+
628+ } else if (uiMbType == MB_TYPE_16x8) {
629+ if (uiNumRefIdxL0Active > 0) {
630+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 0);
631+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 12);
632+ }
633+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth , pCurMb->sMv[0], pMbCache->sMbMvp[0], 0);
634+ pCurMb->sMvd[0].sAssginMv (sMvd);
635+ pCurMb->sMvd[1].sAssginMv (sMvd);
636+
637+
638+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[8], pMbCache->sMbMvp[1], 2);
639+ pCurMb->sMvd[2].sAssginMv (sMvd);
640+ pCurMb->sMvd[3].sAssginMv (sMvd);
641+
642+ } else if (uiMbType == MB_TYPE_8x16) {
643+ if (uiNumRefIdxL0Active > 0) {
644+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 0);
645+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 2);
646+ }
647+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[0], pMbCache->sMbMvp[0], 0);
648+ pCurMb->sMvd[0].sAssginMv (sMvd);
649+ pCurMb->sMvd[2].sAssginMv (sMvd);
650+
651+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[2], pMbCache->sMbMvp[1], 1);
652+ pCurMb->sMvd[1].sAssginMv (sMvd);
653+ pCurMb->sMvd[3].sAssginMv (sMvd);
654+
655+ } else if ((uiMbType == MB_TYPE_8x8) || (uiMbType == MB_TYPE_8x8_REF0)) {
656+ for (i = 0; i < 4; i++)
657+ WelsCabacEncodeDecision (pCabacCtx, 21, 1);
658+
659+ if (uiNumRefIdxL0Active > 0) {
660+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 0);
661+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 2);
662+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 12);
663+ WelsCabacMbRef (pCabacCtx, pCurMb, pMbCache, 14);
664+ }
665+
666+
667+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[0], pMbCache->sMbMvp[0], 0);
668+ pCurMb->sMvd[0].sAssginMv (sMvd);
669+
670+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[2], pMbCache->sMbMvp[1], 1);
671+ pCurMb->sMvd[1].sAssginMv (sMvd);
672+
673+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[8], pMbCache->sMbMvp[2], 2);
674+ pCurMb->sMvd[2].sAssginMv (sMvd);
675+
676+ sMvd = WelsCabacMbMvd (pCabacCtx, pCurMb, iMbWidth, pCurMb->sMv[10], pMbCache->sMbMvp[3], 3);
677+ pCurMb->sMvd[3].sAssginMv (sMvd);
678+ }
679+ if (uiMbType != MB_TYPE_INTRA16x16) {
680+ WelsCabacMbCbp (pCurMb, iMbWidth, pCabacCtx);
681+ }
682+ iRet = WelsWriteMbResidualCabac (pSlice, pMbCache, pCurMb, pCabacCtx, iMbWidth, uiChromaQpIndexOffset);
683+ }
684+ if (!IS_INTRA (pCurMb->uiMbType))
685+ pCurMb->uiChromPredMode = 0;
686+
687+ return iRet;
688+}
689+
690+
691+}
codec/encoder/core/src/svc_set_mb_syn_cavlc.cpp+41−27
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040
4141 #include "vlc_encoder.h"
4242 #include "ls_defines.h"
43−#include "svc_set_mb_syn_cavlc.h"
43+#include "svc_set_mb_syn.h"
4444
4545 namespace WelsEnc {
4646 const uint32_t g_kuiIntra4x4CbpMap[48] = {
@@ -220,40 +220,54 @@ int32_t CheckBitstreamBuffer (const uint32_t kuiSliceIdx, sWelsEncCtx* pEncCtx, · 173 unmodified lines
220220 }
221221
222222 //============================Base Layer CAVLC Writing===============================
223−int32_t WelsSpatialWriteMbSyn (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb) {
223+int32_t WelsSpatialWriteMbSyn (void* pCtx, SSlice* pSlice, SMB* pCurMb) {
224+ sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
224225 SBitStringAux* pBs = pSlice->pSliceBsa;
225226 SMbCache* pMbCache = &pSlice->sMbCacheInfo;
227+ const uint8_t kuiChromaQpIndexOffset = pEncCtx->pCurDqLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
226228
227− /* Step 1: write mb type and pred */
228− if (IS_Inter_8x8 (pCurMb->uiMbType)) {
229− WelsSpatialWriteSubMbPred (pEncCtx, pSlice, pCurMb);
229+ if (IS_SKIP (pCurMb->uiMbType)) {
230+ pCurMb->uiLumaQp = pSlice->uiLastMbQp;
231+ pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];
232+
233+ pSlice->iMbSkipRun++;
234+ return ENC_RETURN_SUCCESS;
230235 } else {
231− WelsSpatialWriteMbPred (pEncCtx, pSlice, pCurMb);
232− }
236+ if (pEncCtx->eSliceType != I_SLICE) {
237+ BsWriteUE (pBs, pSlice->iMbSkipRun);
238+ pSlice->iMbSkipRun = 0;
239+ }
240+ /* Step 1: write mb type and pred */
241+ if (IS_Inter_8x8 (pCurMb->uiMbType)) {
242+ WelsSpatialWriteSubMbPred (pEncCtx, pSlice, pCurMb);
243+ } else {
244+ WelsSpatialWriteMbPred (pEncCtx, pSlice, pCurMb);
245+ }
233246
234− /* Step 2: write coded block patern */
235− if (IS_INTRA4x4 (pCurMb->uiMbType)) {
236− BsWriteUE (pBs, g_kuiIntra4x4CbpMap[pCurMb->uiCbp]);
237− } else if (!IS_INTRA16x16 (pCurMb->uiMbType)) {
238− BsWriteUE (pBs, g_kuiInterCbpMap[pCurMb->uiCbp]);
239− }
247+ /* Step 2: write coded block patern */
248+ if (IS_INTRA4x4 (pCurMb->uiMbType)) {
249+ BsWriteUE (pBs, g_kuiIntra4x4CbpMap[pCurMb->uiCbp]);
250+ } else if (!IS_INTRA16x16 (pCurMb->uiMbType)) {
251+ BsWriteUE (pBs, g_kuiInterCbpMap[pCurMb->uiCbp]);
252+ }
240253
241− /* Step 3: write QP and residual */
242− if (pCurMb->uiCbp > 0 || IS_INTRA16x16 (pCurMb->uiMbType)) {
243− const int32_t kiDeltaQp = pCurMb->uiLumaQp - pSlice->uiLastMbQp;
244− pSlice->uiLastMbQp = pCurMb->uiLumaQp;
254+ /* Step 3: write QP and residual */
255+ if (pCurMb->uiCbp > 0 || IS_INTRA16x16 (pCurMb->uiMbType)) {
256+ const int32_t kiDeltaQp = pCurMb->uiLumaQp - pSlice->uiLastMbQp;
257+ pSlice->uiLastMbQp = pCurMb->uiLumaQp;
258+
259+ BsWriteSE (pBs, kiDeltaQp);
260+ if (WelsWriteMbResidual (pEncCtx->pFuncList, pMbCache, pCurMb, pBs))
261+ return ENC_RETURN_VLCOVERFLOWFOUND;
262+ } else {
263+ pCurMb->uiLumaQp = pSlice->uiLastMbQp;
264+ pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp +
265+ pEncCtx->pCurDqLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset)];
266+ }
245267
246− BsWriteSE (pBs, kiDeltaQp);
247− if (WelsWriteMbResidual (pEncCtx->pFuncList, pMbCache, pCurMb, pBs))
248− return ENC_RETURN_VLCOVERFLOWFOUND;
249− } else {
250− pCurMb->uiLumaQp = pSlice->uiLastMbQp;
251− pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp +
252− pEncCtx->pCurDqLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset)];
268+ /* Step 4: Check the left buffer */
269+ return CheckBitstreamBuffer (pSlice->uiSliceIdx, pEncCtx, pBs);
253270 }
254−
255− /* Step 4: Check the left buffer */
256− return CheckBitstreamBuffer (pSlice->uiSliceIdx, pEncCtx, pBs);
257271 }
258272
259273 int32_t WelsWriteMbResidual (SWelsFuncPtrList* pFuncList, SMbCache* sMbCacheInfo, SMB* pCurMb, SBitStringAux* pBs) {
codec/encoder/targets.mk+3−0
@@ -1,6 +1,7 @@
11 ENCODER_SRCDIR=codec/encoder
22 ENCODER_CPP_SRCS=\
33 $(ENCODER_SRCDIR)/core/src/au_set.cpp\
4+ $(ENCODER_SRCDIR)/core/src/cabac.cpp\
45 $(ENCODER_SRCDIR)/core/src/deblocking.cpp\
56 $(ENCODER_SRCDIR)/core/src/decode_mb_aux.cpp\
67 $(ENCODER_SRCDIR)/core/src/encode_mb_aux.cpp\
@@ -18,6 +19,7 @@ ENCODER_CPP_SRCS=\ · 11 unmodified lines
1819 $(ENCODER_SRCDIR)/core/src/ratectl.cpp\
1920 $(ENCODER_SRCDIR)/core/src/ref_list_mgr_svc.cpp\
2021 $(ENCODER_SRCDIR)/core/src/sample.cpp\
22+ $(ENCODER_SRCDIR)/core/src/set_mb_syn_cabac.cpp\
2123 $(ENCODER_SRCDIR)/core/src/set_mb_syn_cavlc.cpp\
2224 $(ENCODER_SRCDIR)/core/src/slice_multi_threading.cpp\
2325 $(ENCODER_SRCDIR)/core/src/svc_base_layer_md.cpp\
@@ -26,6 +28,7 @@ ENCODER_CPP_SRCS=\ · 2 unmodified lines
2628 $(ENCODER_SRCDIR)/core/src/svc_encode_slice.cpp\
2729 $(ENCODER_SRCDIR)/core/src/svc_mode_decision.cpp\
2830 $(ENCODER_SRCDIR)/core/src/svc_motion_estimate.cpp\
31+ $(ENCODER_SRCDIR)/core/src/svc_set_mb_syn_cabac.cpp\
2932 $(ENCODER_SRCDIR)/core/src/svc_set_mb_syn_cavlc.cpp\
3033 $(ENCODER_SRCDIR)/core/src/wels_preprocess.cpp\
3134 $(ENCODER_SRCDIR)/plus/src/welsEncoderExt.cpp\
test/BaseEncoderTest.h+2−2
@@ -15,9 +15,9 @@ class BaseEncoderTest { · 14 unmodified lines
1515 void SetUp();
1616 void TearDown();
1717 void EncodeFile (const char* fileName, EUsageType usageType, int width, int height, float frameRate,
18− SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk);
18+ SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, bool cabac, Callback* cbk);
1919 void EncodeStream (InputStream* in, EUsageType usageType, int width, int height, float frameRate, SliceModeEnum slices,
20− bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk);
20+ bool denoise, int layers, bool losslessLink, bool enableLtr, bool cabac, Callback* cbk);
2121
2222 ISVCEncoder* encoder_;
2323 private:
test/api/BaseEncoderTest.cpp+7−8
@@ -6,8 +6,8 @@ · 5 unmodified lines
66 #include "BaseEncoderTest.h"
77
88 static int InitWithParam (ISVCEncoder* encoder, EUsageType usageType, int width,
9− int height, float frameRate, SliceModeEnum sliceMode, bool denoise, int layers, bool losslessLink, bool enableLtr) {
10− if (SM_SINGLE_SLICE == sliceMode && !denoise && layers == 1 && !losslessLink && !enableLtr) {
9+ int height, float frameRate, SliceModeEnum sliceMode, bool denoise, int layers, bool losslessLink, bool enableLtr,bool cabac) {
10+ if (SM_SINGLE_SLICE == sliceMode && !denoise && layers == 1 && !losslessLink && !enableLtr &&!cabac) {
1111 SEncParamBase param;
1212 memset (&param, 0, sizeof (SEncParamBase));
1313
@@ -31,7 +31,7 @@ static int InitWithParam (ISVCEncoder* encoder, EUsageType usageType, int width, · 17 unmodified lines
3131 param.iSpatialLayerNum = layers;
3232 param.bIsLosslessLink = losslessLink;
3333 param.bEnableLongTermReference = enableLtr;
34−
34+ param.iEntropyCodingModeFlag = cabac?1:0;
3535 if (sliceMode != SM_SINGLE_SLICE && sliceMode != SM_DYN_SLICE) //SM_DYN_SLICE don't support multi-thread now
3636 param.iMultipleThreadIdc = 2;
3737
@@ -69,9 +69,8 @@ void BaseEncoderTest::TearDown() { · 31 unmodified lines
6969 }
7070
7171 void BaseEncoderTest::EncodeStream (InputStream* in, EUsageType usageType, int width, int height,
72− float frameRate, SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk) {
73− int rv = InitWithParam (encoder_, usageType, width, height, frameRate, slices, denoise, layers, losslessLink,
74− enableLtr);
72+ float frameRate, SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, bool cabac,Callback* cbk) {
73+ int rv = InitWithParam (encoder_, usageType, width, height, frameRate, slices, denoise, layers, losslessLink, enableLtr,cabac);
7574 ASSERT_TRUE (rv == cmResultSuccess);
7675
7776 // I420: 1(Y) + 1/4(U) + 1/4(V)
@@ -104,8 +103,8 @@ void BaseEncoderTest::EncodeStream (InputStream* in, EUsageType usageType, int w · 26 unmodified lines
104103 }
105104
106105 void BaseEncoderTest::EncodeFile (const char* fileName, EUsageType usageType, int width, int height,
107− float frameRate, SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk) {
106+ float frameRate, SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, bool cabac,Callback* cbk) {
108107 FileInputStream fileStream;
109108 ASSERT_TRUE (fileStream.Open (fileName));
110− EncodeStream (&fileStream, usageType, width, height, frameRate, slices, denoise, layers, losslessLink, enableLtr, cbk);
109+ EncodeStream (&fileStream, usageType, width, height, frameRate, slices, denoise, layers, losslessLink, enableLtr, cabac,cbk);
111110 }
test/api/decode_encode_test.cpp+1−2
@@ -99,8 +99,7 @@ TEST_P (DecodeEncodeTest, CompareOutput) { · 98 unmodified lines
9999 #else
100100 ASSERT_TRUE (Open (p.fileName));
101101 #endif
102− EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, false, false,
103− this);
102+ EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, false, false,false, this);
104103 unsigned char digest[SHA_DIGEST_LENGTH];
105104 SHA1Result (&ctx_, digest);
106105 if (!HasFatalFailure()) {
test/api/encoder_test.cpp+24−15
@@ -37,6 +37,7 @@ struct EncodeFileParam { · 36 unmodified lines
3737 int layers;
3838 bool isLossless;
3939 bool enableLtr;
40+ bool cabac;
4041 };
4142
4243 class EncoderOutputTest : public ::testing::WithParamInterface<EncodeFileParam>,
@@ -62,10 +63,10 @@ TEST_P (EncoderOutputTest, CompareOutput) { · 19 unmodified lines
6263 #if defined(ANDROID_NDK)
6364 std::string filename = std::string ("/sdcard/") + p.fileName;
6465 EncodeFile (filename.c_str(), p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless,
65− p.enableLtr, this);
66+ p.enableLtr,p.cabac, this);
6667 #else
6768 EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless,
68− p.enableLtr, this);
69+ p.enableLtr, p.cabac, this);
6970 #endif
7071 //will remove this after screen content algorithms are ready,
7172 //because the bitstream output will vary when the different algorithms are added.
@@ -78,57 +79,65 @@ TEST_P (EncoderOutputTest, CompareOutput) { · 6 unmodified lines
7879 static const EncodeFileParam kFileParamArray[] = {
7980 {
8081 "res/CiscoVT2people_320x192_12fps.yuv",
81− "0a36b75e423fc6b49f6adf7eee12c039a096f538", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false
82+ "0a36b75e423fc6b49f6adf7eee12c039a096f538", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
8283 },
8384 {
8485 "res/CiscoVT2people_160x96_6fps.yuv",
85− "73981e6ea5b62f7338212c538a7cc755e7c9c030", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false
86+ "73981e6ea5b62f7338212c538a7cc755e7c9c030", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
8687 },
8788 {
8889 "res/Static_152_100.yuv",
89− "02bbff550ee0630e44e46e14dc459d3686f2a360", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false
90+ "02bbff550ee0630e44e46e14dc459d3686f2a360", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
9091 },
9192 {
9293 "res/CiscoVT2people_320x192_12fps.yuv",
93− "c8b759bcec7ffa048f1d3ded594b8815bed0aead", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1, false, false // One slice per MB row
94+ "c8b759bcec7ffa048f1d3ded594b8815bed0aead", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1, false, false, false // One slice per MB row
9495 },
9596 {
9697 "res/CiscoVT2people_320x192_12fps.yuv",
97− "e64ba75456c821ca35a949eda89f85bff8ee69fa", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false
98+ "e64ba75456c821ca35a949eda89f85bff8ee69fa", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false, false
9899 },
99100 {
100101 "res/CiscoVT2people_320x192_12fps.yuv",
101− "684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false
102+ "684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false, false
102103 },
103104 {
104105 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
105− "2bc06262d87fa0897ad4c336cc4047d5a67f7203", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false
106+ "2bc06262d87fa0897ad4c336cc4047d5a67f7203", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, false
106107 },
107108 {
108109 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
109− "68c3220e49b7a57d563faf7c99a870ab34a23400", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false
110+ "68c3220e49b7a57d563faf7c99a870ab34a23400", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false, false
110111 },
111112 // the following values may be adjusted for times since we start tuning the strategy
112113 {
113114 "res/CiscoVT2people_320x192_12fps.yuv",
114− "3ce65d9c326657b845cd00b22ce76128c29f8347", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false
115+ "3ce65d9c326657b845cd00b22ce76128c29f8347", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, false
115116 },
116117 {
117118 "res/CiscoVT2people_160x96_6fps.yuv",
118− "2b57e1cc7a4db6258116c302eada3bf870ee94a1", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false
119+ "2b57e1cc7a4db6258116c302eada3bf870ee94a1", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
119120 },
120121 {
121122 "res/Static_152_100.yuv",
122− "bad065da4564d0580a1722d91463fa0f9fd947c8", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false
123+ "bad065da4564d0580a1722d91463fa0f9fd947c8", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false, false
123124 },
124125 {
125126 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
126− "8ee6cd375b58e9877f6145fb72da844e65162b14", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false
127+ "8ee6cd375b58e9877f6145fb72da844e65162b14", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, false
127128 },
128129 //for different strategy
129130 {
130131 "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
131− "868f327765dc8e705ad6a9a942bfc7e32c03c791", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, true, true
132+ "868f327765dc8e705ad6a9a942bfc7e32c03c791", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, true, true, false
133+ },
134+ {
135+ "res/CiscoVT2people_320x192_12fps.yuv",
136+ "fc6faa6409150cce304bcdefb486fee4b4a70e1d", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false, true //turn on cabac
137+ },
138+ {
139+ "res/Cisco_Absolute_Power_1280x720_30fps.yuv",
140+ "7b166367ece61cf489c793872c40c37d4047b7aa", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, true
132141 },
133142 };
134143
testbin/welsenc.cfg+1−1
@@ -14,7 +14,7 @@ IntraPeriod 0 # Intra Period ( multipler of GoP si · 13 unmodified lines
1414 EnableSpsPpsIDAddition 1
1515
1616 EnableFrameCropping 1 # enable frame cropping flag
17−
17+EntropyCodingModeFlag 0 #0:cavlc 1:cabac
1818 MaxNalSize 0 # Unit:Byte, Maximum Nal size
1919 #============================== LOOP FILTER ==============================
2020 LoopFilterDisableIDC 0 # Loop filter idc (0: on, 1: off,
testbin/welsenc_arbitrary_res.cfg+1−1
@@ -14,7 +14,7 @@ IntraPeriod 0 # Intra Period ( multiple of GoP siz · 13 unmodified lines
1414 EnableSpsPpsIDAddition 1
1515
1616 EnableFrameCropping 1 # enable frame cropping flag
17−
17+EntropyCodingModeFlag 0 #0:cavlc 1:cabac
1818 MaxNalSize 0 # Unit:Byte, Maximum Nal size
1919 #============================== LOOP FILTER ==============================
2020 LoopFilterDisableIDC 0 # Loop filter idc (0: on, 1: off,
testbin/welsenc_ios.cfg+1−1
@@ -14,7 +14,7 @@ IntraPeriod 0 # Intra Period ( multipler of GoP si · 13 unmodified lines
1414 EnableSpsPpsIDAddition 1
1515
1616 EnableFrameCropping 1 # enable frame cropping flag
17−
17+EntropyCodingModeFlag 0 #0:cavlc 1:cabac
1818 MaxNalSize 0 # Unit:Byte, Maximum Nal size
1919 #============================== LOOP FILTER ==============================
2020 LoopFilterDisableIDC 0 # Loop filter idc (0: on, 1: off,
testbin/welsenc_vd_1d.cfg+1−1
@@ -14,7 +14,7 @@ IntraPeriod 0 # Intra Period ( multipler of GoP si · 13 unmodified lines
1414 EnableSpsPpsIDAddition 1
1515
1616 EnableFrameCropping 1 # enable frame cropping flag
17−
17+EntropyCodingModeFlag 0 #0:cavlc 1:cabac
1818 MaxNalSize 0 # Unit:Byte, Maximum Nal size
1919 #============================== LOOP FILTER ==============================
2020 LoopFilterDisableIDC 0 # Loop filter idc (0: on, 1: off,
testbin/welsenc_vd_rc.cfg+1−1
@@ -14,7 +14,7 @@ IntraPeriod 0 # Intra Period ( multipler of GoP si · 13 unmodified lines
1414 EnableSpsPpsIDAddition 1
1515
1616 EnableFrameCropping 1 # enable frame cropping flag
17−
17+EntropyCodingModeFlag 0 #0:cavlc 1:cabac
1818 MaxNalSize 0 # Unit:Byte, Maximum Nal size
1919 #============================== LOOP FILTER ==============================
2020 LoopFilterDisableIDC 0 # Loop filter idc (0: on, 1: off,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t