shithub: openh264

Download patch

ref: a6ebecd70712b4bc4ddc0dbf6f7971dbd2091592
parent: ee4341892cfe4009b8c9a4d1710a14de21a717db
parent: 4c12f8970c6d1d2135724f2c86099fbeb08bc7b2
author: huili2 <huili2@cisco.com>
date: Tue Jun 10 06:55:46 EDT 2014

Merge pull request #936 from ruil2/trace_cleanup

    cleanup trace module

--- a/codec/build/iOS/dec/welsdec/welsdec.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/dec/welsdec/welsdec.xcodeproj/project.pbxproj
@@ -26,12 +26,12 @@
 		4CE4469A18BC5EAB0017DF25 /* parse_mb_syn_cavlc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4467718BC5EAA0017DF25 /* parse_mb_syn_cavlc.cpp */; };
 		4CE4469B18BC5EAB0017DF25 /* pic_queue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4467818BC5EAA0017DF25 /* pic_queue.cpp */; };
 		4CE4469C18BC5EAB0017DF25 /* rec_mb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4467918BC5EAA0017DF25 /* rec_mb.cpp */; };
-		4CE4469D18BC5EAB0017DF25 /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4467A18BC5EAA0017DF25 /* utils.cpp */; };
-		4CE4469E18BC5EAB0017DF25 /* welsCodecTrace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4468418BC5EAB0017DF25 /* welsCodecTrace.cpp */; };
 		4CE4469F18BC5EAB0017DF25 /* welsDecoderExt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4468518BC5EAB0017DF25 /* welsDecoderExt.cpp */; };
 		4CE447AC18BC6BE90017DF25 /* block_add_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 4CE447A718BC6BE90017DF25 /* block_add_neon.S */; };
 		4CE447AE18BC6BE90017DF25 /* intra_pred_neon.S in Sources */ = {isa = PBXBuildFile; fileRef = 4CE447A918BC6BE90017DF25 /* intra_pred_neon.S */; };
 		9ABF4382193EB60900A6BD61 /* expand_pic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9ABF4381193EB60900A6BD61 /* expand_pic.cpp */; };
+		9AED66561946A1DE009A3567 /* welsCodecTrace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AED66551946A1DE009A3567 /* welsCodecTrace.cpp */; };
+		9AED66591946A203009A3567 /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AED66581946A203009A3567 /* utils.cpp */; };
 		F0B204FC18FD23D8005DA23F /* error_concealment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F0B204FB18FD23D8005DA23F /* error_concealment.cpp */; };
 /* End PBXBuildFile section */
 
@@ -79,7 +79,6 @@
 		4CE4465F18BC5EAA0017DF25 /* picture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picture.h; sourceTree = "<group>"; };
 		4CE4466018BC5EAA0017DF25 /* rec_mb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rec_mb.h; sourceTree = "<group>"; };
 		4CE4466118BC5EAA0017DF25 /* slice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slice.h; sourceTree = "<group>"; };
-		4CE4466218BC5EAA0017DF25 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
 		4CE4466318BC5EAA0017DF25 /* vlc_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vlc_decoder.h; sourceTree = "<group>"; };
 		4CE4466418BC5EAA0017DF25 /* wels_common_basis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_common_basis.h; sourceTree = "<group>"; };
 		4CE4466518BC5EAA0017DF25 /* wels_const.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_const.h; sourceTree = "<group>"; };
@@ -101,16 +100,17 @@
 		4CE4467718BC5EAA0017DF25 /* parse_mb_syn_cavlc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_mb_syn_cavlc.cpp; sourceTree = "<group>"; };
 		4CE4467818BC5EAA0017DF25 /* pic_queue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pic_queue.cpp; sourceTree = "<group>"; };
 		4CE4467918BC5EAA0017DF25 /* rec_mb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rec_mb.cpp; sourceTree = "<group>"; };
-		4CE4467A18BC5EAA0017DF25 /* utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = utils.cpp; sourceTree = "<group>"; };
-		4CE4467D18BC5EAA0017DF25 /* welsCodecTrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = welsCodecTrace.h; sourceTree = "<group>"; };
 		4CE4467E18BC5EAA0017DF25 /* welsDecoderExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = welsDecoderExt.h; sourceTree = "<group>"; };
 		4CE4468318BC5EAB0017DF25 /* wels_dec_export.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wels_dec_export.def; sourceTree = "<group>"; };
-		4CE4468418BC5EAB0017DF25 /* welsCodecTrace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = welsCodecTrace.cpp; sourceTree = "<group>"; };
 		4CE4468518BC5EAB0017DF25 /* welsDecoderExt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = welsDecoderExt.cpp; sourceTree = "<group>"; };
 		4CE447A718BC6BE90017DF25 /* block_add_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = block_add_neon.S; sourceTree = "<group>"; };
 		4CE447A918BC6BE90017DF25 /* intra_pred_neon.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = intra_pred_neon.S; sourceTree = "<group>"; };
 		9ABF4380193EB5F700A6BD61 /* expand_pic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = expand_pic.h; path = ../../../common/inc/expand_pic.h; sourceTree = "<group>"; };
 		9ABF4381193EB60900A6BD61 /* expand_pic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = expand_pic.cpp; path = ../../../common/src/expand_pic.cpp; sourceTree = "<group>"; };
+		9AED66551946A1DE009A3567 /* welsCodecTrace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = welsCodecTrace.cpp; path = ../../../common/src/welsCodecTrace.cpp; sourceTree = "<group>"; };
+		9AED66571946A1EB009A3567 /* welsCodecTrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = welsCodecTrace.h; path = ../../../common/inc/welsCodecTrace.h; sourceTree = "<group>"; };
+		9AED66581946A203009A3567 /* utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utils.cpp; path = ../../../common/src/utils.cpp; sourceTree = "<group>"; };
+		9AED665A1946A21D009A3567 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../../common/inc/utils.h; sourceTree = "<group>"; };
 		F0B204FA18FD23CF005DA23F /* error_concealment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error_concealment.h; sourceTree = "<group>"; };
 		F0B204FB18FD23D8005DA23F /* error_concealment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = error_concealment.cpp; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -176,6 +176,7 @@
 		4CE4464418BC5EAA0017DF25 /* inc */ = {
 			isa = PBXGroup;
 			children = (
+				9AED665A1946A21D009A3567 /* utils.h */,
 				9ABF4380193EB5F700A6BD61 /* expand_pic.h */,
 				F0B204FA18FD23CF005DA23F /* error_concealment.h */,
 				4CE4464518BC5EAA0017DF25 /* as264_common.h */,
@@ -206,7 +207,6 @@
 				4CE4465F18BC5EAA0017DF25 /* picture.h */,
 				4CE4466018BC5EAA0017DF25 /* rec_mb.h */,
 				4CE4466118BC5EAA0017DF25 /* slice.h */,
-				4CE4466218BC5EAA0017DF25 /* utils.h */,
 				4CE4466318BC5EAA0017DF25 /* vlc_decoder.h */,
 				4CE4466418BC5EAA0017DF25 /* wels_common_basis.h */,
 				4CE4466518BC5EAA0017DF25 /* wels_const.h */,
@@ -217,6 +217,7 @@
 		4CE4466618BC5EAA0017DF25 /* src */ = {
 			isa = PBXGroup;
 			children = (
+				9AED66581946A203009A3567 /* utils.cpp */,
 				9ABF4381193EB60900A6BD61 /* expand_pic.cpp */,
 				F0B204FB18FD23D8005DA23F /* error_concealment.cpp */,
 				4CE4466718BC5EAA0017DF25 /* au_parser.cpp */,
@@ -237,7 +238,6 @@
 				4CE4467718BC5EAA0017DF25 /* parse_mb_syn_cavlc.cpp */,
 				4CE4467818BC5EAA0017DF25 /* pic_queue.cpp */,
 				4CE4467918BC5EAA0017DF25 /* rec_mb.cpp */,
-				4CE4467A18BC5EAA0017DF25 /* utils.cpp */,
 			);
 			path = src;
 			sourceTree = "<group>";
@@ -254,7 +254,7 @@
 		4CE4467C18BC5EAA0017DF25 /* inc */ = {
 			isa = PBXGroup;
 			children = (
-				4CE4467D18BC5EAA0017DF25 /* welsCodecTrace.h */,
+				9AED66571946A1EB009A3567 /* welsCodecTrace.h */,
 				4CE4467E18BC5EAA0017DF25 /* welsDecoderExt.h */,
 			);
 			path = inc;
@@ -263,8 +263,8 @@
 		4CE4468218BC5EAB0017DF25 /* src */ = {
 			isa = PBXGroup;
 			children = (
+				9AED66551946A1DE009A3567 /* welsCodecTrace.cpp */,
 				4CE4468318BC5EAB0017DF25 /* wels_dec_export.def */,
-				4CE4468418BC5EAB0017DF25 /* welsCodecTrace.cpp */,
 				4CE4468518BC5EAB0017DF25 /* welsDecoderExt.cpp */,
 			);
 			path = src;
@@ -333,7 +333,6 @@
 				4CE4469B18BC5EAB0017DF25 /* pic_queue.cpp in Sources */,
 				4CE4469F18BC5EAB0017DF25 /* welsDecoderExt.cpp in Sources */,
 				4CE4469318BC5EAB0017DF25 /* fmo.cpp in Sources */,
-				4CE4469D18BC5EAB0017DF25 /* utils.cpp in Sources */,
 				4CE4469118BC5EAB0017DF25 /* decoder_data_tables.cpp in Sources */,
 				4CE4469718BC5EAB0017DF25 /* mem_align.cpp in Sources */,
 				9ABF4382193EB60900A6BD61 /* expand_pic.cpp in Sources */,
@@ -342,9 +341,9 @@
 				4CE4469918BC5EAB0017DF25 /* mv_pred.cpp in Sources */,
 				4CE447AC18BC6BE90017DF25 /* block_add_neon.S in Sources */,
 				4CE4469418BC5EAB0017DF25 /* get_intra_predictor.cpp in Sources */,
+				9AED66561946A1DE009A3567 /* welsCodecTrace.cpp in Sources */,
 				F0B204FC18FD23D8005DA23F /* error_concealment.cpp in Sources */,
 				4CE4469018BC5EAB0017DF25 /* decoder_core.cpp in Sources */,
-				4CE4469E18BC5EAB0017DF25 /* welsCodecTrace.cpp in Sources */,
 				4CE447AE18BC6BE90017DF25 /* intra_pred_neon.S in Sources */,
 				4CE4469618BC5EAB0017DF25 /* mc.cpp in Sources */,
 				4CE4469C18BC5EAB0017DF25 /* rec_mb.cpp in Sources */,
@@ -352,6 +351,7 @@
 				4CE4468D18BC5EAB0017DF25 /* decode_mb_aux.cpp in Sources */,
 				4CE4468E18BC5EAB0017DF25 /* decode_slice.cpp in Sources */,
 				4CE4468F18BC5EAB0017DF25 /* decoder.cpp in Sources */,
+				9AED66591946A203009A3567 /* utils.cpp in Sources */,
 				4CE4469818BC5EAB0017DF25 /* memmgr_nal_unit.cpp in Sources */,
 				4CE4468C18BC5EAB0017DF25 /* deblocking.cpp in Sources */,
 				4CE4469A18BC5EAB0017DF25 /* parse_mb_syn_cavlc.cpp in Sources */,
--- a/codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj
+++ b/codec/build/iOS/enc/welsenc/welsenc.xcodeproj/project.pbxproj
@@ -41,10 +41,10 @@
 		4CE4472718BC605C0017DF25 /* svc_mode_decision.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446F618BC605C0017DF25 /* svc_mode_decision.cpp */; };
 		4CE4472818BC605C0017DF25 /* svc_motion_estimate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446F718BC605C0017DF25 /* svc_motion_estimate.cpp */; };
 		4CE4472918BC605C0017DF25 /* svc_set_mb_syn_cavlc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446F818BC605C0017DF25 /* svc_set_mb_syn_cavlc.cpp */; };
-		4CE4472A18BC605C0017DF25 /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446F918BC605C0017DF25 /* utils.cpp */; };
 		4CE4472B18BC605C0017DF25 /* wels_preprocess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE446FA18BC605C0017DF25 /* wels_preprocess.cpp */; };
-		4CE4472D18BC605C0017DF25 /* welsCodecTrace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4470518BC605C0017DF25 /* welsCodecTrace.cpp */; };
 		4CE4472E18BC605C0017DF25 /* welsEncoderExt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4470618BC605C0017DF25 /* welsEncoderExt.cpp */; };
+		9AED665019469FC1009A3567 /* welsCodecTrace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AED664C19469FC1009A3567 /* welsCodecTrace.cpp */; };
+		9AED66661946A2B3009A3567 /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AED66651946A2B3009A3567 /* utils.cpp */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -79,7 +79,6 @@
 		4CE446B118BC605C0017DF25 /* encode_mb_aux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = encode_mb_aux.h; sourceTree = "<group>"; };
 		4CE446B218BC605C0017DF25 /* encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = encoder.h; sourceTree = "<group>"; };
 		4CE446B318BC605C0017DF25 /* encoder_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = encoder_context.h; sourceTree = "<group>"; };
-		4CE446B418BC605C0017DF25 /* expand_pic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = expand_pic.h; sourceTree = "<group>"; };
 		4CE446B518BC605C0017DF25 /* extern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = extern.h; sourceTree = "<group>"; };
 		4CE446B618BC605C0017DF25 /* get_intra_predictor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = get_intra_predictor.h; sourceTree = "<group>"; };
 		4CE446B718BC605C0017DF25 /* mb_cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mb_cache.h; sourceTree = "<group>"; };
@@ -112,7 +111,6 @@
 		4CE446D318BC605C0017DF25 /* svc_mode_decision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svc_mode_decision.h; sourceTree = "<group>"; };
 		4CE446D418BC605C0017DF25 /* svc_motion_estimate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svc_motion_estimate.h; sourceTree = "<group>"; };
 		4CE446D518BC605C0017DF25 /* svc_set_mb_syn_cavlc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svc_set_mb_syn_cavlc.h; sourceTree = "<group>"; };
-		4CE446D618BC605C0017DF25 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
 		4CE446D718BC605C0017DF25 /* vlc_encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vlc_encoder.h; sourceTree = "<group>"; };
 		4CE446D818BC605C0017DF25 /* wels_common_basis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_common_basis.h; sourceTree = "<group>"; };
 		4CE446D918BC605C0017DF25 /* wels_const.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wels_const.h; sourceTree = "<group>"; };
@@ -145,13 +143,14 @@
 		4CE446F618BC605C0017DF25 /* svc_mode_decision.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = svc_mode_decision.cpp; sourceTree = "<group>"; };
 		4CE446F718BC605C0017DF25 /* svc_motion_estimate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = svc_motion_estimate.cpp; sourceTree = "<group>"; };
 		4CE446F818BC605C0017DF25 /* svc_set_mb_syn_cavlc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = svc_set_mb_syn_cavlc.cpp; sourceTree = "<group>"; };
-		4CE446F918BC605C0017DF25 /* utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = utils.cpp; sourceTree = "<group>"; };
 		4CE446FA18BC605C0017DF25 /* wels_preprocess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wels_preprocess.cpp; sourceTree = "<group>"; };
-		4CE446FD18BC605C0017DF25 /* welsCodecTrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = welsCodecTrace.h; sourceTree = "<group>"; };
 		4CE446FE18BC605C0017DF25 /* welsEncoderExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = welsEncoderExt.h; sourceTree = "<group>"; };
 		4CE4470418BC605C0017DF25 /* wels_enc_export.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wels_enc_export.def; sourceTree = "<group>"; };
-		4CE4470518BC605C0017DF25 /* welsCodecTrace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = welsCodecTrace.cpp; sourceTree = "<group>"; };
 		4CE4470618BC605C0017DF25 /* welsEncoderExt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = welsEncoderExt.cpp; sourceTree = "<group>"; };
+		9AED664819469FAF009A3567 /* welsCodecTrace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = welsCodecTrace.h; path = ../../../common/inc/welsCodecTrace.h; sourceTree = "<group>"; };
+		9AED664C19469FC1009A3567 /* welsCodecTrace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = welsCodecTrace.cpp; path = ../../../common/src/welsCodecTrace.cpp; sourceTree = "<group>"; };
+		9AED66651946A2B3009A3567 /* utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utils.cpp; path = ../../../common/src/utils.cpp; sourceTree = "<group>"; };
+		9AED66671946A2C4009A3567 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../../common/inc/utils.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -236,6 +235,7 @@
 		4CE446A918BC605C0017DF25 /* inc */ = {
 			isa = PBXGroup;
 			children = (
+				9AED66671946A2C4009A3567 /* utils.h */,
 				4CDBFB9D18E5068D0025A767 /* wels_transpose_matrix.h */,
 				4CE446AA18BC605C0017DF25 /* as264_common.h */,
 				4CE446AB18BC605C0017DF25 /* au_set.h */,
@@ -246,7 +246,6 @@
 				4CE446B118BC605C0017DF25 /* encode_mb_aux.h */,
 				4CE446B218BC605C0017DF25 /* encoder.h */,
 				4CE446B318BC605C0017DF25 /* encoder_context.h */,
-				4CE446B418BC605C0017DF25 /* expand_pic.h */,
 				4CE446B518BC605C0017DF25 /* extern.h */,
 				4CE446B618BC605C0017DF25 /* get_intra_predictor.h */,
 				4CE446B718BC605C0017DF25 /* mb_cache.h */,
@@ -279,7 +278,6 @@
 				4CE446D318BC605C0017DF25 /* svc_mode_decision.h */,
 				4CE446D418BC605C0017DF25 /* svc_motion_estimate.h */,
 				4CE446D518BC605C0017DF25 /* svc_set_mb_syn_cavlc.h */,
-				4CE446D618BC605C0017DF25 /* utils.h */,
 				4CE446D718BC605C0017DF25 /* vlc_encoder.h */,
 				4CE446D818BC605C0017DF25 /* wels_common_basis.h */,
 				4CE446D918BC605C0017DF25 /* wels_const.h */,
@@ -292,6 +290,7 @@
 		4CE446DC18BC605C0017DF25 /* src */ = {
 			isa = PBXGroup;
 			children = (
+				9AED66651946A2B3009A3567 /* utils.cpp */,
 				4CE446DD18BC605C0017DF25 /* au_set.cpp */,
 				4CE446DE18BC605C0017DF25 /* deblocking.cpp */,
 				4CE446DF18BC605C0017DF25 /* decode_mb_aux.cpp */,
@@ -319,7 +318,6 @@
 				4CE446F618BC605C0017DF25 /* svc_mode_decision.cpp */,
 				4CE446F718BC605C0017DF25 /* svc_motion_estimate.cpp */,
 				4CE446F818BC605C0017DF25 /* svc_set_mb_syn_cavlc.cpp */,
-				4CE446F918BC605C0017DF25 /* utils.cpp */,
 				4CE446FA18BC605C0017DF25 /* wels_preprocess.cpp */,
 			);
 			path = src;
@@ -337,7 +335,7 @@
 		4CE446FC18BC605C0017DF25 /* inc */ = {
 			isa = PBXGroup;
 			children = (
-				4CE446FD18BC605C0017DF25 /* welsCodecTrace.h */,
+				9AED664819469FAF009A3567 /* welsCodecTrace.h */,
 				4CE446FE18BC605C0017DF25 /* welsEncoderExt.h */,
 			);
 			path = inc;
@@ -346,8 +344,8 @@
 		4CE4470218BC605C0017DF25 /* src */ = {
 			isa = PBXGroup;
 			children = (
+				9AED664C19469FC1009A3567 /* welsCodecTrace.cpp */,
 				4CE4470418BC605C0017DF25 /* wels_enc_export.def */,
-				4CE4470518BC605C0017DF25 /* welsCodecTrace.cpp */,
 				4CE4470618BC605C0017DF25 /* welsEncoderExt.cpp */,
 			);
 			path = src;
@@ -409,12 +407,11 @@
 				4CE4472718BC605C0017DF25 /* svc_mode_decision.cpp in Sources */,
 				4CE4472818BC605C0017DF25 /* svc_motion_estimate.cpp in Sources */,
 				4CE4471D18BC605C0017DF25 /* property.cpp in Sources */,
-				4CE4472A18BC605C0017DF25 /* utils.cpp in Sources */,
 				4CE4471018BC605C0017DF25 /* decode_mb_aux.cpp in Sources */,
 				4CE4472018BC605C0017DF25 /* sample.cpp in Sources */,
-				4CE4472D18BC605C0017DF25 /* welsCodecTrace.cpp in Sources */,
 				4CE4471318BC605C0017DF25 /* encoder_data_tables.cpp in Sources */,
 				4C34067118C57D0400DFA14A /* pixel_neon.S in Sources */,
+				9AED665019469FC1009A3567 /* welsCodecTrace.cpp in Sources */,
 				4CE4471F18BC605C0017DF25 /* ref_list_mgr_svc.cpp in Sources */,
 				4CE4472218BC605C0017DF25 /* slice_multi_threading.cpp in Sources */,
 				4C34067018C57D0400DFA14A /* memory_neon.S in Sources */,
@@ -435,6 +432,7 @@
 				4CE4471E18BC605C0017DF25 /* ratectl.cpp in Sources */,
 				4C34066D18C57D0400DFA14A /* intra_pred_neon.S in Sources */,
 				4CE4471C18BC605C0017DF25 /* picture_handle.cpp in Sources */,
+				9AED66661946A2B3009A3567 /* utils.cpp in Sources */,
 				4CE4472618BC605C0017DF25 /* svc_encode_slice.cpp in Sources */,
 				4CE4471218BC605C0017DF25 /* encoder.cpp in Sources */,
 				4CE4471618BC605C0017DF25 /* get_intra_predictor.cpp in Sources */,
--- a/codec/build/win32/dec/WelsDecCore.vcproj
+++ b/codec/build/win32/dec/WelsDecCore.vcproj
@@ -818,7 +818,7 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\..\decoder\core\inc\utils.h"
+					RelativePath="..\..\..\common\inc\utils.h"
 					>
 				</File>
 				<File
@@ -939,7 +939,7 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\..\decoder\core\src\utils.cpp"
+					RelativePath="..\..\..\common\src\utils.cpp"
 					>
 				</File>
 			</Filter>
--- a/codec/build/win32/dec/WelsDecPlus.vcproj
+++ b/codec/build/win32/dec/WelsDecPlus.vcproj
@@ -421,7 +421,7 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\..\decoder\plus\src\welsCodecTrace.cpp"
+					RelativePath="..\..\..\common\src\welsCodecTrace.cpp"
 					>
 				</File>
 				<File
@@ -438,7 +438,7 @@
 					>
 				</File>
 				<File
-					RelativePath="..\..\..\decoder\plus\inc\welsCodecTrace.h"
+					RelativePath="..\..\..\common\inc\welsCodecTrace.h"
 					>
 				</File>
 				<File
--- a/codec/build/win32/enc/WelsEncCore.vcproj
+++ b/codec/build/win32/enc/WelsEncCore.vcproj
@@ -480,7 +480,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\encoder\core\src\utils.cpp"
+				RelativePath="..\..\..\common\src\utils.cpp"
 				>
 			</File>
 			<File
@@ -705,7 +705,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\encoder\core\inc\utils.h"
+				RelativePath="..\..\..\common\inc\utils.h"
 				>
 			</File>
 			<File
--- a/codec/build/win32/enc/WelsEncPlus.vcproj
+++ b/codec/build/win32/enc/WelsEncPlus.vcproj
@@ -427,7 +427,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\..\encoder\plus\src\welsCodecTrace.cpp"
+				RelativePath="..\..\..\common\src\welsCodecTrace.cpp"
 				>
 			</File>
 			<File
@@ -440,7 +440,7 @@
 			Filter="h;hpp;hxx;hm;inl"
 			>
 			<File
-				RelativePath="..\..\..\encoder\plus\inc\welsCodecTrace.h"
+				RelativePath="..\..\..\common\inc\welsCodecTrace.h"
 				>
 			</File>
 			<File
--- /dev/null
+++ b/codec/common/inc/utils.h
@@ -1,0 +1,151 @@
+/*!
+ * \copy
+ *     Copyright (c)  2009-2013, Cisco Systems
+ *     All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without
+ *     modification, are permitted provided that the following conditions
+ *     are met:
+ *
+ *        * Redistributions of source code must retain the above copyright
+ *          notice, this list of conditions and the following disclaimer.
+ *
+ *        * Redistributions in binary form must reproduce the above copyright
+ *          notice, this list of conditions and the following disclaimer in
+ *          the documentation and/or other materials provided with the
+ *          distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *     POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * \brief	Tool kits for decoder
+ *		( malloc, realloc, free, log output and PSNR calculation and so on )
+ *
+ * \date	03/10/2009 Created
+ *
+ *************************************************************************************
+ */
+#ifndef WELS_UTILS_H__
+#define WELS_UTILS_H__
+
+#include <stdarg.h>
+#include "typedefs.h"
+
+
+/*
+ *	Log output routines
+ */
+
+typedef int32_t	iWelsLogLevel;
+enum {
+  WELS_LOG_QUIET		= 0x00,		// Quiet mode
+  WELS_LOG_ERROR		= 1 << 0,	// Error log iLevel
+  WELS_LOG_WARNING	= 1 << 1,	// Warning log iLevel
+  WELS_LOG_INFO		= 1 << 2,	// Information log iLevel
+  WELS_LOG_DEBUG		= 1 << 3,	// Debug log iLevel
+  WELS_LOG_RESV		= 1 << 4,	// Resversed log iLevel
+  WELS_LOG_LEVEL_COUNT = 5,
+  WELS_LOG_DEFAULT	= WELS_LOG_ERROR | WELS_LOG_WARNING | WELS_LOG_INFO | WELS_LOG_DEBUG	// Default log iLevel in Wels codec
+};
+
+/*
+ *	Function pointer declaration for various tool sets
+ */
+// wels log output
+typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const char* kpFmt, va_list argv);
+
+// wels psnr calc
+typedef float (*PWelsPsnrFunc) (const void* kpTarPic,
+                                const int32_t kiTarStride,
+                                const void* kpRefPic,
+                                const int32_t kiRefStride,
+                                const int32_t kiWidth,
+                                const int32_t kiHeight);
+
+
+
+#ifdef __GNUC__
+extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) __attribute__ ((__format__ (__printf__, 3,
+    4)));
+#else
+extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...);
+#endif
+
+/*!
+ *************************************************************************************
+ * \brief	set log iLevel from external call
+ *
+ * \param	iLevel	iLevel of log
+ *
+ * \return	NONE
+ *
+ * \note	can be able to control log iLevel dynamically
+ *************************************************************************************
+ */
+void WelsSetLogLevel (const int32_t kiLevel);
+
+/*!
+ *************************************************************************************
+ * \brief	get log iLevel from external call
+ *
+ * \param	N/A
+ *
+ * \return	current iLevel of log used in codec internal
+ *
+ * \note	can be able to get log iLevel of internal codec applicable
+ *************************************************************************************
+ */
+int32_t WelsGetLogLevel (void);
+
+/*!
+ *************************************************************************************
+ * \brief	set log callback from external call
+ *
+ * \param	_log	log function routine
+ *
+ * \return	NONE
+ *
+ * \note	N/A
+ *************************************************************************************
+ */
+void WelsSetLogCallback (PWelsLogCallbackFunc _log);
+
+/*
+ *	PSNR calculation routines
+ */
+/*!
+ *************************************************************************************
+ * \brief	PSNR calculation utilization in Wels
+ *
+ * \param	kpTarPic		target picture to be calculated in Picture pData format
+ * \param	kiTarStride	stride of target picture pData pBuffer
+ * \param 	kpRefPic		base referencing picture samples
+ * \param	kiRefStride	stride of reference picture pData pBuffer
+ * \param	kiWidth		picture iWidth in pixel
+ * \param	kiHeight		picture iHeight in pixel
+ *
+ * \return	actual PSNR result;
+ *
+ * \note	N/A
+ *************************************************************************************
+ */
+float WelsCalcPsnr (const void* kpTarPic,
+                    const int32_t kiTarStride,
+                    const void* kpRefPic,
+                    const int32_t kiRefStride,
+                    const int32_t kiWidth,
+                    const int32_t kiHeight);
+
+
+#endif//WELS_UTILS_H__
--- /dev/null
+++ b/codec/common/inc/welsCodecTrace.h
@@ -1,0 +1,65 @@
+/*!
+ * \copy
+ *     Copyright (c)  2013, Cisco Systems
+ *     All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without
+ *     modification, are permitted provided that the following conditions
+ *     are met:
+ *
+ *        * Redistributions of source code must retain the above copyright
+ *          notice, this list of conditions and the following disclaimer.
+ *
+ *        * Redistributions in binary form must reproduce the above copyright
+ *          notice, this list of conditions and the following disclaimer in
+ *          the documentation and/or other materials provided with the
+ *          distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *     POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef WELS_CODEC_TRACE
+#define WELS_CODEC_TRACE
+
+#include <stdarg.h>
+#include "typedefs.h"
+
+typedef int32_t (*CM_WELS_TRACE) (const char* format, ...);
+
+class welsCodecTrace {
+ public:
+  welsCodecTrace();
+  ~welsCodecTrace();
+
+  static void TraceString (int32_t iLevel, const char* kpStrFormat);
+  static void CODEC_TRACE (void* pIgnore, const int32_t kiLevel, const char* kpStrFormat, va_list vl);
+
+  void SetTraceLevel (const int32_t kiLevel);
+  int32_t WelsTraceModuleIsExist();
+
+ private:
+
+  int32_t m_WelsTraceExistFlag;
+
+ public:
+  static int32_t	m_iTraceLevel;
+  static CM_WELS_TRACE m_fpDebugTrace;
+  static CM_WELS_TRACE m_fpInfoTrace;
+  static CM_WELS_TRACE m_fpWarnTrace;
+  static CM_WELS_TRACE m_fpErrorTrace;
+
+};
+
+#endif //WELS_CODEC_TRACE
--- /dev/null
+++ b/codec/common/src/utils.cpp
@@ -1,0 +1,173 @@
+/*!
+ * \copy
+ *     Copyright (c)  2009-2013, Cisco Systems
+ *     All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without
+ *     modification, are permitted provided that the following conditions
+ *     are met:
+ *
+ *        * Redistributions of source code must retain the above copyright
+ *          notice, this list of conditions and the following disclaimer.
+ *
+ *        * Redistributions in binary form must reproduce the above copyright
+ *          notice, this list of conditions and the following disclaimer in
+ *          the documentation and/or other materials provided with the
+ *          distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *     POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * \file	utils.c
+ *
+ * \brief	common tool/function utilization
+ *
+ * \date	03/10/2009 Created
+ *
+ *************************************************************************************
+ */
+#include "utils.h"
+#include "crt_util_safe_x.h"	// Safe CRT routines like utils for cross platforms
+
+float WelsCalcPsnr (const void* kpTarPic,
+                    const int32_t kiTarStride,
+                    const void* kpRefPic,
+                    const int32_t kiRefStride,
+                    const int32_t kiWidth,
+                    const int32_t kiHeight);
+
+
+iWelsLogLevel		g_iLevelLog	= WELS_LOG_DEFAULT;	// default log iLevel
+int32_t			g_iSizeLogBuf	= 1024;			// pBuffer size for each log output
+PWelsLogCallbackFunc	wlog;
+
+/*!
+ *************************************************************************************
+ * \brief	set log iLevel from external call
+ *
+ * \param	iLevel	iLevel of log
+ *
+ * \return	NONE
+ *
+ * \note	can be able to control log iLevel dynamically
+ *************************************************************************************
+ */
+void WelsSetLogLevel (const int32_t kiLevel) {
+  iWelsLogLevel iVal = 0;
+  if (kiLevel & WELS_LOG_ERROR) {
+    iVal |= WELS_LOG_ERROR;
+  }
+  if (kiLevel & WELS_LOG_WARNING) {
+    iVal |= WELS_LOG_WARNING;
+  }
+  if (kiLevel & WELS_LOG_INFO) {
+    iVal |= WELS_LOG_INFO;
+  }
+  if (kiLevel & WELS_LOG_DEBUG) {
+    iVal |= WELS_LOG_DEBUG;
+  }
+  g_iLevelLog	= iVal;
+}
+
+/*!
+ *************************************************************************************
+ * \brief	get log iLevel from external call
+ *
+ * \param	N/A
+ *
+ * \return	current iLevel of log used in codec internal
+ *
+ * \note	can be able to get log iLevel of internal codec applicable
+ *************************************************************************************
+ */
+int32_t WelsGetLogLevel (void) {
+  return g_iLevelLog;
+}
+
+/*!
+ *************************************************************************************
+ * \brief	set log callback from external call
+ *
+ * \param	_log	log function routine
+ *
+ * \return	NONE
+ *
+ * \note	N/A
+ *************************************************************************************
+ */
+void WelsSetLogCallback (PWelsLogCallbackFunc _log) {
+  wlog	= _log;
+}
+
+void WelsLogCall (void* pCtx, int32_t iLevel, const char* kpFmt, va_list vl) {
+  wlog (pCtx, iLevel, kpFmt, vl);
+}
+
+void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) {
+  va_list vl;
+  va_start (vl, kpFmt);
+  WelsLogCall (pCtx, iLevel, kpFmt, vl);
+  va_end (vl);
+}
+
+#ifndef CALC_PSNR
+#define CONST_FACTOR_PSNR	(10.0 / log(10.0))	// for good computation
+#define CALC_PSNR(w, h, s)	((float)(CONST_FACTOR_PSNR * log( 65025.0 * w * h / iSqe )))
+#endif//CALC_PSNR
+
+/*
+ *	PSNR calculation routines
+ */
+/*!
+ *************************************************************************************
+ * \brief	PSNR calculation utilization in Wels
+ *
+ * \param	pTarPic		target picture to be calculated in Picture pData format
+ * \param	iTarStride	stride of target picture pData pBuffer
+ * \param 	pRefPic		base referencing picture samples
+ * \param	iRefStride	stride of reference picture pData pBuffer
+ * \param	iWidth		picture iWidth in pixel
+ * \param	iHeight		picture iHeight in pixel
+ *
+ * \return	actual PSNR result;
+ *
+ * \note	N/A
+ *************************************************************************************
+ */
+float WelsCalcPsnr (const void* kpTarPic,
+                    const int32_t kiTarStride,
+                    const void* kpRefPic,
+                    const int32_t kiRefStride,
+                    const int32_t kiWidth,
+                    const int32_t kiHeight) {
+  int64_t	iSqe = 0;
+  int32_t x, y;
+  uint8_t* pTar = (uint8_t*)kpTarPic;
+  uint8_t* pRef = (uint8_t*)kpRefPic;
+
+  if (NULL == pTar || NULL == pRef)
+    return (-1.0f);
+
+  for (y = 0; y < kiHeight; ++ y) {	// OPTable !!
+    for (x = 0; x < kiWidth; ++ x) {
+      const int32_t kiT = pTar[y * kiTarStride + x] - pRef[y * kiRefStride + x];
+      iSqe	+= kiT * kiT;
+    }
+  }
+  if (0 == iSqe) {
+    return (99.99f);
+  }
+  return CALC_PSNR (kiWidth, kiHeight, iSqe);
+}
+
--- /dev/null
+++ b/codec/common/src/welsCodecTrace.cpp
@@ -1,0 +1,127 @@
+/*!
+ * \copy
+ *     Copyright (c)  2013, Cisco Systems
+ *     All rights reserved.
+ *
+ *     Redistribution and use in source and binary forms, with or without
+ *     modification, are permitted provided that the following conditions
+ *     are met:
+ *
+ *        * Redistributions of source code must retain the above copyright
+ *          notice, this list of conditions and the following disclaimer.
+ *
+ *        * Redistributions in binary form must reproduce the above copyright
+ *          notice, this list of conditions and the following disclaimer in
+ *          the documentation and/or other materials provided with the
+ *          distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *     POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifdef _WIN32
+#include <windows.h>
+#include <tchar.h>
+#endif
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "crt_util_safe_x.h"	// Safe CRT routines like utils for cross platforms
+
+#include "welsCodecTrace.h"
+#include "utils.h"
+
+#include "logging.h"
+
+int32_t	welsCodecTrace::m_iTraceLevel			= WELS_LOG_DEFAULT;
+CM_WELS_TRACE welsCodecTrace::m_fpDebugTrace	= NULL;
+CM_WELS_TRACE welsCodecTrace::m_fpInfoTrace	= NULL;
+CM_WELS_TRACE welsCodecTrace::m_fpWarnTrace	= NULL;
+CM_WELS_TRACE welsCodecTrace::m_fpErrorTrace	= NULL;
+
+welsCodecTrace::welsCodecTrace() {
+
+  m_fpDebugTrace = welsStderrTrace<WELS_LOG_DEBUG>;
+  m_fpInfoTrace = welsStderrTrace<WELS_LOG_INFO>;
+  m_fpWarnTrace = welsStderrTrace<WELS_LOG_WARNING>;
+  m_fpErrorTrace = welsStderrTrace<WELS_LOG_ERROR>;
+  m_WelsTraceExistFlag = true;
+}
+
+welsCodecTrace::~welsCodecTrace() {
+  m_fpDebugTrace = NULL;
+  m_fpInfoTrace = NULL;
+  m_fpWarnTrace = NULL;
+  m_fpErrorTrace = NULL;
+//	g_bWelsLibLoaded = false;
+  m_WelsTraceExistFlag = false;
+}
+
+int32_t welsCodecTrace::WelsTraceModuleIsExist() {
+  return m_WelsTraceExistFlag;
+}
+
+void welsCodecTrace::TraceString (int32_t iLevel, const char* str) {
+  switch (iLevel) {
+  case WELS_LOG_ERROR:
+    if (m_fpErrorTrace)
+      m_fpErrorTrace ("%s", str);
+    break;
+  case WELS_LOG_WARNING:
+    if (m_fpWarnTrace)
+      m_fpWarnTrace ("%s", str);
+    break;
+  case WELS_LOG_INFO:
+    if (m_fpInfoTrace)
+      m_fpInfoTrace ("%s", str);
+    break;
+  case WELS_LOG_DEBUG:
+    if (m_fpDebugTrace)
+      m_fpDebugTrace ("%s", str);
+    break;
+  default:
+    if (m_fpDebugTrace)
+      m_fpInfoTrace ("%s", str);
+    break;
+  }
+}
+
+#define MAX_LOG_SIZE	1024
+
+void welsCodecTrace::CODEC_TRACE (void* ignore, const int32_t iLevel, const char* Str_Format, va_list vl) {
+//		if(g_traceLevel < iLevel)
+  if (m_iTraceLevel < iLevel) {
+    return;
+  }
+
+  char pBuf[MAX_LOG_SIZE] = {0};
+  const int32_t len	= strlen ("[ENCODER]: ");	// confirmed_safe_unsafe_usage
+
+
+  WelsStrncpy (pBuf, MAX_LOG_SIZE, "[ENCODER]: ");	// confirmed_safe_unsafe_usage
+  WelsVsnprintf (pBuf + len, MAX_LOG_SIZE - len, Str_Format, vl);	// confirmed_safe_unsafe_usage
+
+//		g_WelsCodecTrace.TraceString(iLevel, pBuf);
+  welsCodecTrace::TraceString (iLevel, pBuf);
+}
+
+void welsCodecTrace::SetTraceLevel (const int32_t iLevel) {
+  if (iLevel >= 0)
+    m_iTraceLevel	= iLevel;
+  WelsStderrSetTraceLevel (iLevel);
+}
+
+
--- a/codec/common/targets.mk
+++ b/codec/common/targets.mk
@@ -7,6 +7,8 @@
 	$(COMMON_SRCDIR)/src/expand_pic.cpp\
 	$(COMMON_SRCDIR)/src/logging.cpp\
 	$(COMMON_SRCDIR)/src/sad_common.cpp\
+	$(COMMON_SRCDIR)/src/utils.cpp\
+	$(COMMON_SRCDIR)/src/welsCodecTrace.cpp\
 	$(COMMON_SRCDIR)/src/WelsThreadLib.cpp\
 
 COMMON_OBJS += $(COMMON_CPP_SRCS:.cpp=.$(OBJ))
--- a/codec/decoder/core/inc/decoder.h
+++ b/codec/decoder/core/inc/decoder.h
@@ -68,7 +68,7 @@
  * \note	N/A
  *************************************************************************************
  */
-int32_t WelsInitDecoder (PWelsDecoderContext pCtx,  void* pTraceHandle, PWelsLogCallbackFunc pLog);
+int32_t WelsInitDecoder (PWelsDecoderContext pCtx);
 
 /*!
  *************************************************************************************
--- a/codec/decoder/core/inc/utils.h
+++ /dev/null
@@ -1,90 +1,0 @@
-/*!
- * \copy
- *     Copyright (c)  2009-2013, Cisco Systems
- *     All rights reserved.
- *
- *     Redistribution and use in source and binary forms, with or without
- *     modification, are permitted provided that the following conditions
- *     are met:
- *
- *        * Redistributions of source code must retain the above copyright
- *          notice, this list of conditions and the following disclaimer.
- *
- *        * Redistributions in binary form must reproduce the above copyright
- *          notice, this list of conditions and the following disclaimer in
- *          the documentation and/or other materials provided with the
- *          distribution.
- *
- *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *     POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * \file	utils.h
- *
- * \brief	Tool kits for decoder
- *		( malloc, realloc, free, log output and PSNR calculation and so on )
- *
- * \date	03/10/2009 Created
- *
- *************************************************************************************
- */
-#ifndef WELS_UTILS_H__
-#define WELS_UTILS_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include "typedefs.h"
-
-namespace WelsDec {
-
-
-/*
- *	Function pointer declaration for various tool sets
- */
-// wels log output
-typedef void (*PWelsLogCallbackFunc) (void* pPtr, const int32_t kiLevel, const char* kpFmt, va_list pArgv);
-
-extern PWelsLogCallbackFunc	g_pLog;
-
-#ifdef __GNUC__
-extern void WelsLog (void* pPtr, int32_t iLevel, const char* kpFmt, ...) __attribute__ ((__format__ (__printf__, 3,
-    4)));
-#else
-extern void WelsLog (void* pPtr, int32_t iLevel, const char* kpFmt, ...);
-#endif
-
-#define BUFFER_STATUS_NAME(a) ((a == 0)?"unvalid":"valid")
-
-
-/*
- *	Log output routines
- */
-
-typedef int32_t	WelsLogLevel;
-enum {
-  WELS_LOG_QUIET		= 0x00,		// Quiet mode
-  WELS_LOG_ERROR		= 1 << 0,	// Error log level
-  WELS_LOG_WARNING	= 1 << 1,	// Warning log level
-  WELS_LOG_INFO		= 1 << 2,	// Information log level
-  WELS_LOG_DEBUG		= 1 << 3,	// Debug log level
-  WELS_LOG_RESV		= 1 << 4,	// Resversed log level
-  WELS_LOG_LEVEL_COUNT = 5,
-  WELS_LOG_DEFAULT	= WELS_LOG_ERROR | WELS_LOG_WARNING | WELS_LOG_INFO | WELS_LOG_DEBUG	// Default log level in Wels codec
-};
-
-
-
-} // namespace WelsDec
-
-#endif//WELS_UTILS_H__
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -350,7 +350,7 @@
  * \note	N/A
  *************************************************************************************
  */
-int32_t WelsInitDecoder (PWelsDecoderContext pCtx, void* pTraceHandle, PWelsLogCallbackFunc pLog) {
+int32_t WelsInitDecoder (PWelsDecoderContext pCtx) {
   if (pCtx == NULL) {
     return ERR_INFO_INVALID_PTR;
   }
@@ -357,10 +357,6 @@
 
   // default
   WelsDecoderDefaults (pCtx);
-
-  pCtx->pTraceHandle = pTraceHandle;
-
-  g_pLog = pLog;
 
   // open decoder
   WelsOpenDecoder (pCtx);
--- a/codec/decoder/core/src/utils.cpp
+++ /dev/null
@@ -1,61 +1,0 @@
-/*!
- * \copy
- *     Copyright (c)  2009-2013, Cisco Systems
- *     All rights reserved.
- *
- *     Redistribution and use in source and binary forms, with or without
- *     modification, are permitted provided that the following conditions
- *     are met:
- *
- *        * Redistributions of source code must retain the above copyright
- *          notice, this list of conditions and the following disclaimer.
- *
- *        * Redistributions in binary form must reproduce the above copyright
- *          notice, this list of conditions and the following disclaimer in
- *          the documentation and/or other materials provided with the
- *          distribution.
- *
- *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *     POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * \file	utils.c
- *
- * \brief	common tool/function utilization
- *
- * \date	03/10/2009 Created
- *
- *************************************************************************************
- */
-
-#include "utils.h"
-#include "decoder_context.h"
-
-namespace WelsDec {
-
-// to fill default routines
-PWelsLogCallbackFunc g_pLog	= NULL;
-
-
-
-void WelsLog (void* pPtr, int32_t iLevel, const char* kpFmt, ...) {
-  va_list pVl;
-
-  PWelsDecoderContext pCtx  = (PWelsDecoderContext)pPtr;
-
-  va_start (pVl, kpFmt);
-  g_pLog (pCtx->pTraceHandle, iLevel, kpFmt, pVl);
-  va_end (pVl);
-}
-
-} // namespace WelsDec
--- a/codec/decoder/plus/inc/welsCodecTrace.h
+++ /dev/null
@@ -1,159 +1,0 @@
-/*!
- * \copy
- *     Copyright (c)  2013, Cisco Systems
- *     All rights reserved.
- *
- *     Redistribution and use in source and binary forms, with or without
- *     modification, are permitted provided that the following conditions
- *     are met:
- *
- *        * Redistributions of source code must retain the above copyright
- *          notice, this list of conditions and the following disclaimer.
- *
- *        * Redistributions in binary form must reproduce the above copyright
- *          notice, this list of conditions and the following disclaimer in
- *          the documentation and/or other materials provided with the
- *          distribution.
- *
- *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *     POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef WELS_CODEC_TRACE
-#define WELS_CODEC_TRACE
-
-
-#include "typedefs.h"
-
-//using namespace WelsDec;
-namespace WelsDec {
-
-typedef int (*CM_WELS_TRACE) (const char* kpFormat, ...);
-
-
-typedef  enum {
-  Wels_Trace_Type     = 0,
-  Wels_Trace_Type_File    = 1,
-  Wels_Trace_Type_WinDgb  = 2,
-} EWelsTraceType;
-
-class  IWelsTrace {
- public:
-  enum {
-    WELS_LOG_QUIET     = 0,
-    WELS_LOG_ERROR     = 1 << 0,
-    WELS_LOG_WARNING   = 1 << 1,
-    WELS_LOG_INFO      = 1 << 2,
-    WELS_LOG_DEBUG     = 1 << 3,
-    WELS_LOG_RESV      = 1 << 4,
-    WELS_LOG_DEFAULT   = WELS_LOG_ERROR | WELS_LOG_WARNING | WELS_LOG_INFO | WELS_LOG_DEBUG,
-
-
-    MAX_LOG_SIZE       = 1024,
-  };
-
-  virtual ~IWelsTrace() {};
-
-  virtual int32_t  SetTraceLevel (int32_t iLevel) = 0;
-  virtual int32_t  Trace (const int32_t kLevel, const char* kpFormat,  va_list pVl) = 0;
-
-  static void  WelsTrace (void* pObject, const int32_t kLevel, const char* kpFormat, va_list pVl) {
-    IWelsTrace*   pThis = (IWelsTrace*) (pObject);
-
-    if (pThis) {
-      pThis->Trace (kLevel, kpFormat, pVl);
-    }
-  }
-
-  static void WelsVTrace (void* pObject, const int32_t kLevel, const char* kpFormat, ...) {
-    IWelsTrace* pThis = (IWelsTrace*) (pObject);
-
-    va_list  argptr;
-
-    va_start (argptr, kpFormat);
-
-    if (pThis) {
-      pThis->Trace (kLevel, kpFormat, argptr);
-    }
-
-    va_end (argptr);
-  }
-
-
-};
-
-class CWelsTraceBase : public IWelsTrace {
- public:
-  virtual int32_t  SetTraceLevel (int32_t iLevel);
-  virtual int32_t  Trace (const int32_t kLevel, const char* kpFormat,  va_list pVl);
-
-  virtual int32_t  WriteString (int32_t iLevel, const char* pStr) = 0;
- protected:
-  CWelsTraceBase() {
-    m_iLevel = WELS_LOG_DEFAULT;
-  };
-
- private:
-  int32_t   m_iLevel;
-};
-
-class CWelsTraceFile : public CWelsTraceBase {
- public:
-  CWelsTraceFile (const char*   filename = (const char*)"wels_decoder_trace.txt");
-  virtual ~CWelsTraceFile();
-
- public:
-  virtual int32_t  WriteString (int32_t iLevel, const char* pStr);
-
- private:
-  WelsFileHandle* m_pTraceFile;
-};
-
-#ifdef  _WIN32
-class CWelsTraceWinDgb : public CWelsTraceBase {
- public:
-  CWelsTraceWinDgb() {};
-  virtual ~CWelsTraceWinDgb() {};
-
- public:
-  virtual int32_t  WriteString (int32_t iLevel, const char* pStr);
-};
-#endif
-
-class CWelsCodecTrace : public CWelsTraceBase {
- public:
-  CWelsCodecTrace() ;
-  virtual ~CWelsCodecTrace();
-
- public:
-  virtual int32_t  WriteString (int32_t iLevel, const char* pStr);
-
- protected:
-  int32_t  LoadWelsTraceModule();
-  int32_t  UnloadWelsTraceModule();
-
- private:
-
-  CM_WELS_TRACE m_fpDebugTrace;
-  CM_WELS_TRACE m_fpInfoTrace;
-  CM_WELS_TRACE m_fpWarnTrace;
-  CM_WELS_TRACE m_fpErrorTrace;
-};
-
-
-IWelsTrace*   CreateWelsTrace (EWelsTraceType  eType,  void* pParam = NULL);
-
-} // namespace WelsDec
-
-#endif //WELS_CODEC_TRACE
--- a/codec/decoder/plus/inc/welsDecoderExt.h
+++ b/codec/decoder/plus/inc/welsDecoderExt.h
@@ -99,7 +99,7 @@
 
  private:
   PWelsDecoderContext 				m_pDecContext;
-  IWelsTrace*							m_pTrace;
+  welsCodecTrace*			m_pWelsTrace;
 
   void InitDecoder (void);
   void UninitDecoder (void);
--- a/codec/decoder/plus/src/welsCodecTrace.cpp
+++ /dev/null
@@ -1,188 +1,0 @@
-/*!
- * \copy
- *     Copyright (c)  2013, Cisco Systems
- *     All rights reserved.
- *
- *     Redistribution and use in source and binary forms, with or without
- *     modification, are permitted provided that the following conditions
- *     are met:
- *
- *        * Redistributions of source code must retain the above copyright
- *          notice, this list of conditions and the following disclaimer.
- *
- *        * Redistributions in binary form must reproduce the above copyright
- *          notice, this list of conditions and the following disclaimer in
- *          the documentation and/or other materials provided with the
- *          distribution.
- *
- *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *     POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifdef _WIN32
-#include <windows.h>
-#include <tchar.h>
-#endif
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include "crt_util_safe_x.h"	// Safe CRT routines like utils for cross platforms
-#include "utils.h"
-
-#include "welsCodecTrace.h"
-#include "utils.h"
-#include "logging.h"
-
-//using namespace WelsDec;
-
-namespace WelsDec {
-
-
-int32_t  CWelsTraceBase::SetTraceLevel (int iLevel) {
-  m_iLevel = iLevel;
-
-  return 0;
-}
-
-int32_t  CWelsTraceBase::Trace (const int kLevel, const char* kpFormat, va_list pVl) {
-  if (kLevel & m_iLevel) {
-    char chBuf[MAX_LOG_SIZE] = {0};
-    const int32_t kLen	= strlen ("[DECODER]: ");
-
-    WelsStrncpy (chBuf, MAX_LOG_SIZE, (const char*)"[DECODER]: ");
-
-    WelsVsnprintf ((chBuf + kLen),  MAX_LOG_SIZE - kLen, (const char*)kpFormat, pVl);
-
-    WriteString (kLevel, chBuf);
-  }
-
-  return 0;
-}
-
-CWelsTraceFile::CWelsTraceFile (const char* pFileName) {
-  m_pTraceFile = WelsFopen (pFileName, (const char*)"wt");
-}
-
-CWelsTraceFile::~CWelsTraceFile() {
-  if (m_pTraceFile) {
-    WelsFclose (m_pTraceFile);
-    m_pTraceFile = NULL;
-  }
-}
-
-int32_t CWelsTraceFile::WriteString (int32_t iLevel, const char* pStr) {
-  int  iRC = 0;
-  const static char chEnter[16] = "\n";
-  if (m_pTraceFile) {
-    iRC += WelsFwrite (pStr, 1, strlen (pStr), m_pTraceFile);
-    iRC += WelsFwrite (chEnter, 1, strlen (chEnter), m_pTraceFile);
-    WelsFflush (m_pTraceFile);
-  }
-  return iRC;
-}
-
-
-#ifdef _WIN32
-
-int32_t CWelsTraceWinDgb::WriteString (int32_t iLevel, const char* pStr) {
-  OutputDebugStringA (pStr);
-
-  return strlen (pStr);
-}
-
-#endif
-
-CWelsCodecTrace::CWelsCodecTrace() {
-  m_fpDebugTrace = NULL;
-  m_fpInfoTrace = NULL;
-  m_fpWarnTrace = NULL;
-  m_fpErrorTrace = NULL;
-
-  LoadWelsTraceModule();
-}
-
-CWelsCodecTrace::~CWelsCodecTrace() {
-  UnloadWelsTraceModule();
-}
-
-int32_t  CWelsCodecTrace::LoadWelsTraceModule() {
-  m_fpDebugTrace = welsStderrTrace<WELS_LOG_DEBUG>;
-  m_fpInfoTrace = welsStderrTrace<WELS_LOG_INFO>;
-  m_fpWarnTrace = welsStderrTrace<WELS_LOG_WARNING>;
-  m_fpErrorTrace = welsStderrTrace<WELS_LOG_ERROR>;
-  return 0;
-}
-
-int32_t  CWelsCodecTrace::UnloadWelsTraceModule() {
-  m_fpDebugTrace = NULL;
-  m_fpInfoTrace = NULL;
-  m_fpWarnTrace = NULL;
-  m_fpErrorTrace = NULL;
-  return 0;
-}
-
-int32_t  CWelsCodecTrace::WriteString (int32_t iLevel, const char* pStr) {
-  {
-    switch (iLevel) {
-    case WELS_LOG_ERROR:
-      if (m_fpErrorTrace)
-        m_fpErrorTrace ("%s", pStr);
-      break;
-    case WELS_LOG_WARNING:
-      if (m_fpWarnTrace)
-        m_fpWarnTrace ("%s", pStr);
-      break;
-    case WELS_LOG_INFO:
-      if (m_fpInfoTrace)
-        m_fpInfoTrace ("%s", pStr);
-      break;
-    case WELS_LOG_DEBUG:
-      if (m_fpDebugTrace)
-        m_fpDebugTrace ("%s", pStr);
-      break;
-    default:
-      if (m_fpDebugTrace)
-        m_fpDebugTrace ("%s", pStr);
-      break;
-    }
-  }
-
-  return 0;
-}
-
-
-IWelsTrace*   CreateWelsTrace (EWelsTraceType  eType,  void* pParam) {
-  IWelsTrace*   pTrace = NULL;
-  switch (eType) {
-  case Wels_Trace_Type:
-    pTrace = new CWelsCodecTrace();
-    break;
-  case Wels_Trace_Type_File:
-    pTrace = new CWelsTraceFile();
-    break;
-#ifdef _WIN32
-  case Wels_Trace_Type_WinDgb:
-    pTrace = new CWelsTraceWinDgb();
-    break;
-#endif
-  default:
-    break;
-  }
-
-  return pTrace;
-}
-
-} // namespace WelsDec
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -86,7 +86,7 @@
 ***************************************************************************/
 CWelsDecoder::CWelsDecoder (void)
   :	m_pDecContext (NULL),
-    m_pTrace (NULL) {
+    m_pWelsTrace (NULL) {
 #ifdef OUTPUT_BIT_STREAM
   char chFileName[1024] = { 0 };  //for .264
   int iBufUsed = 0;
@@ -99,10 +99,21 @@
   int iCurUsedSize;
 #endif//OUTPUT_BIT_STREAM
 
-  m_pTrace = CreateWelsTrace (Wels_Trace_Type);
 
-  IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
+  m_pWelsTrace	= new welsCodecTrace();
+  if (m_pWelsTrace != NULL) {
+    const int32_t iWelsTraceExistingFlag = m_pWelsTrace->WelsTraceModuleIsExist();
+    if (iWelsTraceExistingFlag) {
+      m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
+      WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
+    }
+  }
 
+  // initialization
+  WelsSetLogLevel (WELS_LOG_ERROR);	// no output, WELS_LOG_QUIET
+
+  WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
+
 #ifdef OUTPUT_BIT_STREAM
   SWelsTime sCurTime;
 
@@ -156,7 +167,7 @@
 *	return: none
 ***************************************************************************/
 CWelsDecoder::~CWelsDecoder() {
-  IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "CWelsDecoder::~CWelsDecoder()");
+  WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::~CWelsDecoder()");
 
   UninitDecoder();
 
@@ -171,15 +182,15 @@
   }
 #endif//OUTPUT_BIT_STREAM
 
-  if (NULL != m_pTrace) {
-    delete m_pTrace;
-    m_pTrace = NULL;
+  if (m_pWelsTrace != NULL) {
+    delete m_pWelsTrace;
+    m_pWelsTrace = NULL;
   }
 }
 
 long CWelsDecoder::Initialize (const SDecodingParam* pParam) {
   if (pParam == NULL) {
-    IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument.");
+    WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument.");
     return cmInitParaError;
   }
 
@@ -201,7 +212,7 @@
   if (NULL == m_pDecContext)
     return;
 
-  IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "into CWelsDecoder::uninit_decoder()..");
+  WelsLog (NULL, WELS_LOG_INFO, "into CWelsDecoder::uninit_decoder()..");
 
   WelsEndDecoder (m_pDecContext);
 
@@ -211,18 +222,19 @@
     m_pDecContext	= NULL;
   }
 
-  IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "left CWelsDecoder::uninit_decoder()..");
+  WelsLog (NULL , WELS_LOG_INFO, "left CWelsDecoder::uninit_decoder()..");
 }
 
 // the return value of this function is not suitable, it need report failure info to upper layer.
 void CWelsDecoder::InitDecoder (void) {
-  IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "CWelsDecoder::init_decoder()..");
 
+  WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::init_decoder()..");
+
   m_pDecContext	= (PWelsDecoderContext)WelsMalloc (sizeof (SWelsDecoderContext), "m_pDecContext");
 
-  WelsInitDecoder (m_pDecContext, m_pTrace, IWelsTrace::WelsTrace);
+  WelsInitDecoder (m_pDecContext);
 
-  IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "CWelsDecoder::init_decoder().. left");
+  WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::init_decoder().. left");
 }
 
 /*
@@ -380,8 +392,8 @@
       }
     }
 
-    IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "decode failed, failure type:%d \n",
-                            m_pDecContext->iErrorCode);
+    WelsLog (NULL, WELS_LOG_INFO, "decode failed, failure type:%d \n",
+             m_pDecContext->iErrorCode);
     return (DECODING_STATE)m_pDecContext->iErrorCode;
   }
 
--- a/codec/decoder/targets.mk
+++ b/codec/decoder/targets.mk
@@ -19,8 +19,6 @@
 	$(DECODER_SRCDIR)/core/src/parse_mb_syn_cavlc.cpp\
 	$(DECODER_SRCDIR)/core/src/pic_queue.cpp\
 	$(DECODER_SRCDIR)/core/src/rec_mb.cpp\
-	$(DECODER_SRCDIR)/core/src/utils.cpp\
-	$(DECODER_SRCDIR)/plus/src/welsCodecTrace.cpp\
 	$(DECODER_SRCDIR)/plus/src/welsDecoderExt.cpp\
 
 DECODER_OBJS += $(DECODER_CPP_SRCS:.cpp=.$(OBJ))
--- a/codec/encoder/core/inc/as264_common.h
+++ b/codec/encoder/core/inc/as264_common.h
@@ -148,12 +148,6 @@
 #endif//MEMORY_MONITOR
 #endif//MEMORY_CHECK
 
-//#define ENABLE_TRACE_FILE
-#if defined(_WIN32) && defined(_DEBUG)
-#ifdef ENABLE_TRACE_FILE
-#undef ENABLE_TRACE_FILE
-#endif//ENABLE_TRACE_FILE
-#endif//_WIN32 & _DEBUG
 
 
 #endif // AS264_COMMON_H_
--- a/codec/encoder/core/inc/encoder_context.h
+++ b/codec/encoder/core/inc/encoder_context.h
@@ -206,12 +206,6 @@
   SParaSetOffset				sPSOVector;
   CMemoryAlign*				pMemAlign;
 
-#ifdef ENABLE_TRACE_FILE
-  WelsFileHandle*				pFileLog;		// log file for wels encoder
-  uint32_t					uiSizeLog;		// size of log have been written in file
-
-#endif//ENABLE_TRACE_FILE
-
 #if defined(STAT_OUTPUT)
   // overall stat pData, refer to SStatData in stat.h, in case avc to use stat[0][0]
   SStatData					sStatData [ MAX_DEPENDENCY_LAYER ] [ MAX_QUALITY_LEVEL ];
--- a/codec/encoder/core/inc/utils.h
+++ /dev/null
@@ -1,187 +1,0 @@
-/*!
- * \copy
- *     Copyright (c)  2009-2013, Cisco Systems
- *     All rights reserved.
- *
- *     Redistribution and use in source and binary forms, with or without
- *     modification, are permitted provided that the following conditions
- *     are met:
- *
- *        * Redistributions of source code must retain the above copyright
- *          notice, this list of conditions and the following disclaimer.
- *
- *        * Redistributions in binary form must reproduce the above copyright
- *          notice, this list of conditions and the following disclaimer in
- *          the documentation and/or other materials provided with the
- *          distribution.
- *
- *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *     POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * \brief	Tool kits for decoder
- *		( malloc, realloc, free, log output and PSNR calculation and so on )
- *
- * \date	03/10/2009 Created
- *
- *************************************************************************************
- */
-#ifndef WELS_UTILS_H__
-#define WELS_UTILS_H__
-
-#include <stdarg.h>
-#include "typedefs.h"
-
-namespace WelsSVCEnc {
-
-
-/*
- *	Log output routines
- */
-
-typedef int32_t	iWelsLogLevel;
-enum {
-  WELS_LOG_QUIET		= 0x00,		// Quiet mode
-  WELS_LOG_ERROR		= 1 << 0,	// Error log iLevel
-  WELS_LOG_WARNING	= 1 << 1,	// Warning log iLevel
-  WELS_LOG_INFO		= 1 << 2,	// Information log iLevel
-  WELS_LOG_DEBUG		= 1 << 3,	// Debug log iLevel
-  WELS_LOG_RESV		= 1 << 4,	// Resversed log iLevel
-  WELS_LOG_LEVEL_COUNT = 5,
-  WELS_LOG_DEFAULT	= WELS_LOG_ERROR | WELS_LOG_WARNING | WELS_LOG_INFO | WELS_LOG_DEBUG	// Default log iLevel in Wels codec
-};
-
-/*
- *	Function pointer declaration for various tool sets
- */
-// wels log output
-typedef void (*PWelsLogCallbackFunc) (void* pCtx, const int32_t iLevel, const char* kpFmt, va_list argv);
-
-// wels psnr calc
-typedef float (*PWelsPsnrFunc) (const void* kpTarPic,
-                                const int32_t kiTarStride,
-                                const void* kpRefPic,
-                                const int32_t kiRefStride,
-                                const int32_t kiWidth,
-                                const int32_t kiHeight);
-
-extern PWelsLogCallbackFunc	wlog;
-
-#ifdef __GNUC__
-extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) __attribute__ ((__format__ (__printf__, 3,
-    4)));
-#else
-extern void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...);
-#endif
-
-extern const char* g_sWelsLogTags[];
-
-/*!
- *************************************************************************************
- * \brief	System trace log output in Wels
- *
- * \param	pCtx	instance pointer
- * \param	kiLevel	log iLevel ( WELS_LOG_QUIET, ERROR, WARNING, INFO, DEBUG )
- * \param	kpFmtStr	formated string to mount
- * \param 	argv	pData string argument
- *
- * \return	NONE
- *
- * \note	N/A
- *************************************************************************************
- */
-void WelsLogDefault (void* pCtx, const int32_t kiLevel, const char* kpFmtStr, va_list argv);
-void WelsLogNil (void* pCtx, const int32_t kiLevel, const char* kpFmtStr, va_list argv);
-
-
-/*!
- *************************************************************************************
- * \brief	set log iLevel from external call
- *
- * \param	iLevel	iLevel of log
- *
- * \return	NONE
- *
- * \note	can be able to control log iLevel dynamically
- *************************************************************************************
- */
-void WelsSetLogLevel (const int32_t kiLevel);
-
-/*!
- *************************************************************************************
- * \brief	get log iLevel from external call
- *
- * \param	N/A
- *
- * \return	current iLevel of log used in codec internal
- *
- * \note	can be able to get log iLevel of internal codec applicable
- *************************************************************************************
- */
-int32_t WelsGetLogLevel (void);
-
-/*!
- *************************************************************************************
- * \brief	set log callback from external call
- *
- * \param	_log	log function routine
- *
- * \return	NONE
- *
- * \note	N/A
- *************************************************************************************
- */
-void WelsSetLogCallback (PWelsLogCallbackFunc _log);
-
-/*!
-*************************************************************************************
-* \brief	reopen log file when finish setting current path
-*
-* \param	pCtx		context pCtx
-* \param	pCurPath	current path string
-*
-* \return	NONE
-*
-* \note	N/A
-*************************************************************************************
-*/
-void WelsReopenTraceFile (void* pCtx, char* pCurPath);
-
-/*
- *	PSNR calculation routines
- */
-/*!
- *************************************************************************************
- * \brief	PSNR calculation utilization in Wels
- *
- * \param	kpTarPic		target picture to be calculated in Picture pData format
- * \param	kiTarStride	stride of target picture pData pBuffer
- * \param 	kpRefPic		base referencing picture samples
- * \param	kiRefStride	stride of reference picture pData pBuffer
- * \param	kiWidth		picture iWidth in pixel
- * \param	kiHeight		picture iHeight in pixel
- *
- * \return	actual PSNR result;
- *
- * \note	N/A
- *************************************************************************************
- */
-float WelsCalcPsnr (const void* kpTarPic,
-                    const int32_t kiTarStride,
-                    const void* kpRefPic,
-                    const int32_t kiRefStride,
-                    const int32_t kiWidth,
-                    const int32_t kiHeight);
-
-}
-#endif//WELS_UTILS_H__
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -1712,14 +1712,6 @@
       pCtx->pMvdCostTableInter = NULL;
     }
 
-#ifdef ENABLE_TRACE_FILE
-    if (NULL != pCtx->pFileLog) {
-      WelsFclose (pCtx->pFileLog);
-      pCtx->pFileLog	= NULL;
-    }
-    pCtx->uiSizeLog	= 0;
-#endif//ENABLE_TRACE_FILE
-
     FreeCodingParam (&pCtx->pSvcParam, pMa);
     if (NULL != pCtx->pFuncList) {
       pMa->WelsFree (pCtx->pFuncList, "SWelsFuncPtrList");
@@ -1975,19 +1967,6 @@
 
   pCtx->pMemAlign = new CMemoryAlign (iCacheLineSize);
   WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pCtx->pMemAlign), FreeMemorySvc (&pCtx))
-
-  // for logs
-#ifdef ENABLE_TRACE_FILE
-  if (wlog == WelsLogDefault) {
-    char fname[MAX_FNAME_LEN] = {0};
-
-    WelsSnprintf (fname, MAX_FNAME_LEN, "wels_svc_encoder_trace.txt");
-
-
-    pCtx->pFileLog	= WelsFopen (fname, "wt+");
-    pCtx->uiSizeLog	= 0;
-  }
-#endif//ENABLE_TRACE_FILE
 
   pCodingParam->DetermineTemporalSettings();
   iRet = AllocCodingParam (&pCtx->pSvcParam, pCtx->pMemAlign);
--- a/codec/encoder/core/src/utils.cpp
+++ /dev/null
@@ -1,379 +1,0 @@
-/*!
- * \copy
- *     Copyright (c)  2009-2013, Cisco Systems
- *     All rights reserved.
- *
- *     Redistribution and use in source and binary forms, with or without
- *     modification, are permitted provided that the following conditions
- *     are met:
- *
- *        * Redistributions of source code must retain the above copyright
- *          notice, this list of conditions and the following disclaimer.
- *
- *        * Redistributions in binary form must reproduce the above copyright
- *          notice, this list of conditions and the following disclaimer in
- *          the documentation and/or other materials provided with the
- *          distribution.
- *
- *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *     POSSIBILITY OF SUCH DAMAGE.
- *
- *
- * \file	utils.c
- *
- * \brief	common tool/function utilization
- *
- * \date	03/10/2009 Created
- *
- *************************************************************************************
- */
-#if defined(_WIN32)
-#include <windows.h>
-#include <sys/types.h>
-#include <sys/timeb.h>
-#ifndef _MSC_VER
-#include <sys/time.h>
-#endif
-#else
-#include <sys/time.h>
-#endif
-
-#include "utils.h"
-#include "property.h"
-#include "encoder_context.h"
-#include "property.h"
-#include "crt_util_safe_x.h"	// Safe CRT routines like utils for cross platforms
-
-
-namespace WelsSVCEnc {
-
-void WelsLogDefault (void* pCtx, const int32_t kiLevel, const char* kpFmtStr, va_list argv);
-void WelsLogNil (void* pCtx, const int32_t kiLevel, const char* kpFmtStr, va_list argv);
-
-float WelsCalcPsnr (const void* kpTarPic,
-                    const int32_t kiTarStride,
-                    const void* kpRefPic,
-                    const int32_t kiRefStride,
-                    const int32_t kiWidth,
-                    const int32_t kiHeight);
-
-// to fill default routines
-#ifdef ENABLE_TRACE_FILE
-PWelsLogCallbackFunc wlog	= WelsLogDefault;
-#else
-PWelsLogCallbackFunc wlog	= WelsLogNil;
-#endif
-
-iWelsLogLevel		g_iLevelLog	= WELS_LOG_DEFAULT;	// default log iLevel
-int32_t			g_iSizeLogBuf	= 1024;			// pBuffer size for each log output
-
-/*
- *	Log output routines
- */
-
-/*!
- * \brief	get log tag
- * \param	kiLevel		log iLevel
- * \return  tag of log iLevel
- */
-static inline char* GetLogTag (const int32_t kiLevel, int32_t* pBit) {
-  int32_t iShift	= 0;
-  int32_t iVal		= 0;
-  bool	bFound	= false;
-
-  if (kiLevel <= 0 || kiLevel > (1 << (WELS_LOG_LEVEL_COUNT - 1)) || NULL == pBit)
-    return NULL;
-
-  for (;;) {
-    if (iShift >= WELS_LOG_LEVEL_COUNT)
-      break;
-    iVal	= (1 << iShift);
-    if (iVal == kiLevel) {
-      bFound	= true;
-      break;
-    }
-    ++ iShift;
-  }
-
-  if (bFound) {
-    *pBit	= iShift;
-    return (char*)g_sWelsLogTags[iShift];
-  }
-  return NULL;
-}
-
-/*!
- *************************************************************************************
- * \brief	System trace log output in Wels
- *
- * \param	pCtx	instance pointer
- * \param	kiLevel	log iLevel ( WELS_LOG_QUIET, ERROR, WARNING, INFO, DEBUG )
- * \param	kpFmtStr	formated string to mount
- * \param 	argv	pData string argument
- *
- * \return	NONE
- *
- * \note	N/A
- *************************************************************************************
- */
-void WelsLogDefault (void* pCtx, const int32_t kiLevel, const char* kpFmtStr, va_list argv) {
-  sWelsEncCtx* pEncCtx	= (sWelsEncCtx*)pCtx;
-  iWelsLogLevel		 iVal	= (kiLevel & g_iLevelLog);
-
-  if (0 == iVal || NULL == pEncCtx) {	// such iLevel not enabled
-    return;
-  } else {
-    char pBuf[WELS_LOG_BUF_SIZE + 1] = {0};
-    const int32_t kiBufSize = sizeof (pBuf) / sizeof (pBuf[0]) - 1;
-    int32_t iCurUsed = 0;
-    int32_t iBufUsed = 0;
-    int32_t iBufLeft = kiBufSize - iBufUsed;
-
-    if (pEncCtx) {
-      SWelsTime tTime;
-
-      WelsGetTimeOfDay (&tTime);
-      iCurUsed = WelsSnprintf (&pBuf[iBufUsed], iBufLeft, "[0x%p @ ", pEncCtx);	// confirmed_safe_unsafe_usage
-      iBufUsed += iCurUsed;
-      iBufLeft -= iCurUsed;
-
-      if (iBufLeft > 0) {
-        iCurUsed = GetCodeName (&pBuf[iBufUsed], iBufLeft);
-        iBufUsed += iCurUsed;
-        iBufLeft -= iCurUsed;
-        pBuf[iBufUsed] = ' ';
-        ++ iBufUsed;
-        -- iBufLeft;
-
-        iCurUsed = GetLibName (&pBuf[iBufUsed], iBufLeft);
-        iBufUsed += iCurUsed;
-        iBufLeft -= iCurUsed;
-        pBuf[iBufUsed] = ' ';
-        ++ iBufUsed;
-        -- iBufLeft;
-
-        pBuf[iBufUsed] = 'v';
-        ++ iBufUsed;
-        -- iBufLeft;
-        iCurUsed = GetVerNum (&pBuf[iBufUsed], iBufLeft);
-        iBufUsed += iCurUsed;
-        iBufLeft -= iCurUsed;
-        pBuf[iBufUsed] = ' ';
-        ++ iBufUsed;
-        -- iBufLeft;
-      }
-
-      if (iBufLeft > 0) {
-        iCurUsed = WelsStrftime (&pBuf[iBufUsed], iBufLeft, "%y-%m-%d %H:%M:%S", &tTime);
-        iBufUsed += iCurUsed;
-        iBufLeft -= iCurUsed;
-      } else {
-        return;
-      }
-
-      if (iBufLeft > 0) {
-        iCurUsed = WelsSnprintf (&pBuf[iBufUsed], iBufLeft, ".%3.3u]: ", tTime.millitm);	// confirmed_safe_unsafe_usage
-        iBufUsed += iCurUsed;
-        iBufLeft -= iCurUsed;
-      } else {
-        return;
-      }
-    }
-
-    // fixed stack corruption issue on vs2008
-    if (iBufLeft > 0) {
-      int32_t i_shift = 0;
-      char* pStr = NULL;
-      pStr	= GetLogTag (kiLevel, &i_shift);
-      if (NULL != pStr) {
-        iCurUsed = WelsSnprintf (&pBuf[iBufUsed], iBufLeft, "%s ", pStr);
-        iBufUsed += iCurUsed;
-        iBufLeft -= iCurUsed;
-      }
-    }
-    if (iBufLeft > 0) {
-      iCurUsed = WelsVsnprintf (&pBuf[iBufUsed], iBufLeft, kpFmtStr, argv);	// confirmed_safe_unsafe_usage
-      iBufUsed += iCurUsed;
-      iBufLeft -= iCurUsed;
-    }
-#ifdef ENABLE_TRACE_FILE
-    if (NULL != pEncCtx && NULL != pEncCtx->pFileLog) {
-      if (pEncCtx->uiSizeLog > MAX_TRACE_LOG_SIZE) {
-        if (0 == WelsFseek (pEncCtx->pFileLog, 0L, SEEK_SET))
-          pEncCtx->uiSizeLog = 0;
-      }
-      if (iBufUsed > 0 && iBufUsed < WELS_LOG_BUF_SIZE) {
-        iCurUsed = WelsFwrite (pBuf, 1, iBufUsed, pEncCtx->pFileLog);
-        WelsFflush (pEncCtx->pFileLog);
-        if (iCurUsed == iBufUsed)
-          pEncCtx->uiSizeLog += iBufUsed;
-      }
-    } else {
-#if defined(_WIN32) && defined(_DEBUG)
-      OutputDebugStringA (pBuf);
-#endif
-    }
-#endif//ENABLE_TRACE_FILE
-  }
-}
-void WelsLogNil (void* pCtx, const int32_t kiLevel, const char* kpFmtStr, va_list argv) {
-  // NULL implementation
-}
-
-/*!
-*************************************************************************************
-* \brief	reopen log file when finish setting current path
-*
-* \param	pCtx		context pCtx
-* \param	pCurPath	current path string
-*
-* \return	NONE
-*
-* \note	N/A
-*************************************************************************************
-*/
-void WelsReopenTraceFile (void* pCtx, char* pCurPath) {
-#ifdef ENABLE_TRACE_FILE
-  sWelsEncCtx* pEncCtx	= (sWelsEncCtx*)pCtx;
-  if (wlog == WelsLogDefault) {
-    if (pEncCtx->pFileLog != NULL) {
-      WelsFclose (pEncCtx->pFileLog);
-      pEncCtx->pFileLog = NULL;
-    }
-    pEncCtx->uiSizeLog	= 0;
-    pEncCtx->pFileLog	= WelsFopen ("wels_encoder_trace.txt", "wt+");	// confirmed_safe_unsafe_usage
-  }
-#endif//ENABLE_TRACE_FILE
-}
-
-/*!
- *************************************************************************************
- * \brief	set log iLevel from external call
- *
- * \param	iLevel	iLevel of log
- *
- * \return	NONE
- *
- * \note	can be able to control log iLevel dynamically
- *************************************************************************************
- */
-void WelsSetLogLevel (const int32_t kiLevel) {
-  iWelsLogLevel iVal = 0;
-  if (kiLevel & WELS_LOG_ERROR) {
-    iVal |= WELS_LOG_ERROR;
-  }
-  if (kiLevel & WELS_LOG_WARNING) {
-    iVal |= WELS_LOG_WARNING;
-  }
-  if (kiLevel & WELS_LOG_INFO) {
-    iVal |= WELS_LOG_INFO;
-  }
-  if (kiLevel & WELS_LOG_DEBUG) {
-    iVal |= WELS_LOG_DEBUG;
-  }
-  g_iLevelLog	= iVal;
-}
-
-/*!
- *************************************************************************************
- * \brief	get log iLevel from external call
- *
- * \param	N/A
- *
- * \return	current iLevel of log used in codec internal
- *
- * \note	can be able to get log iLevel of internal codec applicable
- *************************************************************************************
- */
-int32_t WelsGetLogLevel (void) {
-  return g_iLevelLog;
-}
-
-/*!
- *************************************************************************************
- * \brief	set log callback from external call
- *
- * \param	_log	log function routine
- *
- * \return	NONE
- *
- * \note	N/A
- *************************************************************************************
- */
-void WelsSetLogCallback (PWelsLogCallbackFunc _log) {
-  wlog	= _log;
-}
-
-void WelsLogCall (void* pCtx, int32_t iLevel, const char* kpFmt, va_list vl) {
-  wlog (pCtx, iLevel, kpFmt, vl);
-}
-
-void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) {
-  va_list vl;
-  va_start (vl, kpFmt);
-  WelsLogCall (pCtx, iLevel, kpFmt, vl);
-  va_end (vl);
-}
-
-#ifndef CALC_PSNR
-#define CONST_FACTOR_PSNR	(10.0 / log(10.0))	// for good computation
-#define CALC_PSNR(w, h, s)	((float)(CONST_FACTOR_PSNR * log( 65025.0 * w * h / iSqe )))
-#endif//CALC_PSNR
-
-/*
- *	PSNR calculation routines
- */
-/*!
- *************************************************************************************
- * \brief	PSNR calculation utilization in Wels
- *
- * \param	pTarPic		target picture to be calculated in Picture pData format
- * \param	iTarStride	stride of target picture pData pBuffer
- * \param 	pRefPic		base referencing picture samples
- * \param	iRefStride	stride of reference picture pData pBuffer
- * \param	iWidth		picture iWidth in pixel
- * \param	iHeight		picture iHeight in pixel
- *
- * \return	actual PSNR result;
- *
- * \note	N/A
- *************************************************************************************
- */
-float WelsCalcPsnr (const void* kpTarPic,
-                    const int32_t kiTarStride,
-                    const void* kpRefPic,
-                    const int32_t kiRefStride,
-                    const int32_t kiWidth,
-                    const int32_t kiHeight) {
-  int64_t	iSqe = 0;
-  int32_t x, y;
-  uint8_t* pTar = (uint8_t*)kpTarPic;
-  uint8_t* pRef = (uint8_t*)kpRefPic;
-
-  if (NULL == pTar || NULL == pRef)
-    return (-1.0f);
-
-  for (y = 0; y < kiHeight; ++ y) {	// OPTable !!
-    for (x = 0; x < kiWidth; ++ x) {
-      const int32_t kiT = pTar[y * kiTarStride + x] - pRef[y * kiRefStride + x];
-      iSqe	+= kiT * kiT;
-    }
-  }
-  if (0 == iSqe) {
-    return (99.99f);
-  }
-  return CALC_PSNR (kiWidth, kiHeight, iSqe);
-}
-
-
-}
--- a/codec/encoder/plus/inc/welsCodecTrace.h
+++ /dev/null
@@ -1,65 +1,0 @@
-/*!
- * \copy
- *     Copyright (c)  2013, Cisco Systems
- *     All rights reserved.
- *
- *     Redistribution and use in source and binary forms, with or without
- *     modification, are permitted provided that the following conditions
- *     are met:
- *
- *        * Redistributions of source code must retain the above copyright
- *          notice, this list of conditions and the following disclaimer.
- *
- *        * Redistributions in binary form must reproduce the above copyright
- *          notice, this list of conditions and the following disclaimer in
- *          the documentation and/or other materials provided with the
- *          distribution.
- *
- *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *     POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef WELS_CODEC_TRACE
-#define WELS_CODEC_TRACE
-
-#include <stdarg.h>
-#include "typedefs.h"
-
-typedef int32_t (*CM_WELS_TRACE) (const char* format, ...);
-
-class welsCodecTrace {
- public:
-  welsCodecTrace();
-  ~welsCodecTrace();
-
-  static void TraceString (int32_t iLevel, const char* kpStrFormat);
-  static void CODEC_TRACE (void* pIgnore, const int32_t kiLevel, const char* kpStrFormat, va_list vl);
-
-  void SetTraceLevel (const int32_t kiLevel);
-  int32_t WelsTraceModuleIsExist();
-
- private:
-
-  int32_t m_WelsTraceExistFlag;
-
- public:
-  static int32_t	m_iTraceLevel;
-  static CM_WELS_TRACE m_fpDebugTrace;
-  static CM_WELS_TRACE m_fpInfoTrace;
-  static CM_WELS_TRACE m_fpWarnTrace;
-  static CM_WELS_TRACE m_fpErrorTrace;
-
-};
-
-#endif //WELS_CODEC_TRACE
--- a/codec/encoder/plus/src/welsCodecTrace.cpp
+++ /dev/null
@@ -1,139 +1,0 @@
-/*!
- * \copy
- *     Copyright (c)  2013, Cisco Systems
- *     All rights reserved.
- *
- *     Redistribution and use in source and binary forms, with or without
- *     modification, are permitted provided that the following conditions
- *     are met:
- *
- *        * Redistributions of source code must retain the above copyright
- *          notice, this list of conditions and the following disclaimer.
- *
- *        * Redistributions in binary form must reproduce the above copyright
- *          notice, this list of conditions and the following disclaimer in
- *          the documentation and/or other materials provided with the
- *          distribution.
- *
- *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *     POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifdef _WIN32
-#include <windows.h>
-#include <tchar.h>
-#endif
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-#include "crt_util_safe_x.h"	// Safe CRT routines like utils for cross platforms
-
-#include "welsCodecTrace.h"
-#include "utils.h"
-
-#include "logging.h"
-
-//#define CODEC_TRACE_ERROR 0
-//#define CODEC_TRACE_WARNING 1
-//#define CODEC_TRACE_INFO 2
-//#define CODEC_TRACE_DEDBUG 3
-
-using namespace WelsSVCEnc;
-
-int32_t	welsCodecTrace::m_iTraceLevel			= WELS_LOG_DEFAULT;
-CM_WELS_TRACE welsCodecTrace::m_fpDebugTrace	= NULL;
-CM_WELS_TRACE welsCodecTrace::m_fpInfoTrace	= NULL;
-CM_WELS_TRACE welsCodecTrace::m_fpWarnTrace	= NULL;
-CM_WELS_TRACE welsCodecTrace::m_fpErrorTrace	= NULL;
-
-welsCodecTrace::welsCodecTrace() {
-  m_fpDebugTrace = NULL;
-  m_fpInfoTrace = NULL;
-  m_fpWarnTrace = NULL;
-  m_fpErrorTrace = NULL;
-  m_WelsTraceExistFlag	= false;
-  m_fpDebugTrace = welsStderrTrace<WELS_LOG_DEBUG>;
-  m_fpInfoTrace = welsStderrTrace<WELS_LOG_INFO>;
-  m_fpWarnTrace = welsStderrTrace<WELS_LOG_WARNING>;
-  m_fpErrorTrace = welsStderrTrace<WELS_LOG_ERROR>;
-
-  m_WelsTraceExistFlag = true;
-}
-
-welsCodecTrace::~welsCodecTrace() {
-  m_fpDebugTrace = NULL;
-  m_fpInfoTrace = NULL;
-  m_fpWarnTrace = NULL;
-  m_fpErrorTrace = NULL;
-//	g_bWelsLibLoaded = false;
-  m_WelsTraceExistFlag = false;
-}
-
-int32_t welsCodecTrace::WelsTraceModuleIsExist() {
-  return m_WelsTraceExistFlag;
-}
-
-void welsCodecTrace::TraceString (int32_t iLevel, const char* str) {
-  switch (iLevel) {
-  case WELS_LOG_ERROR:
-    if (m_fpErrorTrace)
-      m_fpErrorTrace ("%s", str);
-    break;
-  case WELS_LOG_WARNING:
-    if (m_fpWarnTrace)
-      m_fpWarnTrace ("%s", str);
-    break;
-  case WELS_LOG_INFO:
-    if (m_fpInfoTrace)
-      m_fpInfoTrace ("%s", str);
-    break;
-  case WELS_LOG_DEBUG:
-    if (m_fpDebugTrace)
-      m_fpDebugTrace ("%s", str);
-    break;
-  default:
-    if (m_fpDebugTrace)
-      m_fpInfoTrace ("%s", str);
-    break;
-  }
-}
-
-#define MAX_LOG_SIZE	1024
-
-void welsCodecTrace::CODEC_TRACE (void* ignore, const int32_t iLevel, const char* Str_Format, va_list vl) {
-//		if(g_traceLevel < iLevel)
-  if (m_iTraceLevel < iLevel) {
-    return;
-  }
-
-  char pBuf[MAX_LOG_SIZE] = {0};
-  const int32_t len	= strlen ("[ENCODER]: ");	// confirmed_safe_unsafe_usage
-
-
-  WelsStrncpy (pBuf, MAX_LOG_SIZE, "[ENCODER]: ");	// confirmed_safe_unsafe_usage
-  WelsVsnprintf (pBuf + len, MAX_LOG_SIZE - len, Str_Format, vl);	// confirmed_safe_unsafe_usage
-
-//		g_WelsCodecTrace.TraceString(iLevel, pBuf);
-  welsCodecTrace::TraceString (iLevel, pBuf);
-}
-
-void welsCodecTrace::SetTraceLevel (const int32_t iLevel) {
-  if (iLevel >= 0)
-    m_iTraceLevel	= iLevel;
-  WelsStderrSetTraceLevel (iLevel);
-}
-
-
--- a/codec/encoder/targets.mk
+++ b/codec/encoder/targets.mk
@@ -27,9 +27,7 @@
 	$(ENCODER_SRCDIR)/core/src/svc_mode_decision.cpp\
 	$(ENCODER_SRCDIR)/core/src/svc_motion_estimate.cpp\
 	$(ENCODER_SRCDIR)/core/src/svc_set_mb_syn_cavlc.cpp\
-	$(ENCODER_SRCDIR)/core/src/utils.cpp\
 	$(ENCODER_SRCDIR)/core/src/wels_preprocess.cpp\
-	$(ENCODER_SRCDIR)/plus/src/welsCodecTrace.cpp\
 	$(ENCODER_SRCDIR)/plus/src/welsEncoderExt.cpp\
 
 ENCODER_OBJS += $(ENCODER_CPP_SRCS:.cpp=.$(OBJ))