shithub: openh264

Download patch

ref: 9b11f253000eb3eaaeb3740042eeda89b6d7b009
parent: f3a5655754104eb29df4e67fca2062d47bfbcf21
author: syureyi <lingzhu2@cisco.com>
date: Mon Jul 21 12:26:33 EDT 2014

also format the file

--- a/codec/build/android/dec/src/com/wels/dec/WelsDecTest.java
+++ b/codec/build/android/dec/src/com/wels/dec/WelsDecTest.java
@@ -16,148 +16,136 @@
 import java.util.Vector;
 
 public class WelsDecTest extends Activity {
-    /** Called when the activity is first created. */
-    private OnClickListener OnClickEvent;
-    private Button mBtnLoad, mBtnStartSW;
+  /** Called when the activity is first created. */
+  private OnClickListener OnClickEvent;
+  private Button mBtnLoad, mBtnStartSW;
 
-    final String   mStreamPath = "/sdcard/welsdec/";
-    Vector<String> mStreamFiles = new Vector<String>();
+  final String   mStreamPath = "/sdcard/welsdec/";
+  Vector<String> mStreamFiles = new Vector<String>();
 
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        final TextView  tv = new TextView(this);
-        System.out.println("Here we go ...");
-        Log.i(TAG, "sdcard path:" + Environment.getExternalStorageDirectory().getAbsolutePath());
-        setContentView(R.layout.main);
+  @Override
+  public void onCreate (Bundle savedInstanceState) {
+    super.onCreate (savedInstanceState);
+    final TextView  tv = new TextView (this);
+    System.out.println ("Here we go ...");
+    Log.i (TAG, "sdcard path:" + Environment.getExternalStorageDirectory().getAbsolutePath());
+    setContentView (R.layout.main);
 
-        mBtnLoad = (Button)findViewById(R.id.cfg);
-        mBtnStartSW = (Button)findViewById(R.id.buttonSW);
+    mBtnLoad = (Button)findViewById (R.id.cfg);
+    mBtnStartSW = (Button)findViewById (R.id.buttonSW);
 
-        OnClickEvent = new OnClickListener()
-        {
-            public void onClick(View v)
-            {
-                switch(v.getId())
-                {
-                case R.id.cfg:
-                {
-                    String cfgFile = mStreamPath + "BitStreams.txt";
-                    try {
-                        BufferedReader bufferedReader = new BufferedReader(new FileReader(cfgFile));
-                        String text;
-                        while((text = bufferedReader.readLine()) != null) {
-                            mStreamFiles.add(mStreamPath + text);
-                            Log.i(TAG, mStreamPath + text);
-                        }
-                        bufferedReader.close();
-                    } catch(IOException e) {
-                        Log.e("WELS_DEC", e.getMessage());
-                    }
-                }
-                break;
-                case R.id.buttonSW:
-                {
-                    System.out.println("decode sequence number = " + mStreamFiles.size());
-                    Log.i("WSE_DEC","after click");
-                    try {
-                        for (int k=0; k < mStreamFiles.size(); k++) {
-                            String inFile =  mStreamFiles.get(k);
-                            String outFile =  mStreamFiles.get(k) + ".yuv";
-                            Log.i(TAG, "input file:" + inFile+ "    output file:" + outFile);
-                            DoDecoderTest(inFile, outFile);
-                        }
-                    } catch (Exception e) {
-                        Log.e(TAG, e.getMessage());
-                    }
-                    mStreamFiles.clear();
-                    tv.setText( "Decoder is completed!" );
-                }
-                break;
-                }
+    OnClickEvent = new OnClickListener() {
+      public void onClick (View v) {
+        switch (v.getId()) {
+        case R.id.cfg: {
+          String cfgFile = mStreamPath + "BitStreams.txt";
+          try {
+            BufferedReader bufferedReader = new BufferedReader (new FileReader (cfgFile));
+            String text;
+            while ((text = bufferedReader.readLine()) != null) {
+              mStreamFiles.add (mStreamPath + text);
+              Log.i (TAG, mStreamPath + text);
+            }
+            bufferedReader.close();
+          } catch (IOException e) {
+            Log.e ("WELS_DEC", e.getMessage());
+          }
+        }
+        break;
+        case R.id.buttonSW: {
+          System.out.println ("decode sequence number = " + mStreamFiles.size());
+          Log.i ("WSE_DEC", "after click");
+          try {
+            for (int k = 0; k < mStreamFiles.size(); k++) {
+              String inFile =  mStreamFiles.get (k);
+              String outFile =  mStreamFiles.get (k) + ".yuv";
+              Log.i (TAG, "input file:" + inFile + "    output file:" + outFile);
+              DoDecoderTest (inFile, outFile);
             }
-        };
+          } catch (Exception e) {
+            Log.e (TAG, e.getMessage());
+          }
+          mStreamFiles.clear();
+          tv.setText ("Decoder is completed!");
+        }
+        break;
+        }
+      }
+    };
 
-        mBtnLoad.setOnClickListener(OnClickEvent);
-        mBtnStartSW.setOnClickListener(OnClickEvent);
+    mBtnLoad.setOnClickListener (OnClickEvent);
+    mBtnStartSW.setOnClickListener (OnClickEvent);
 
-        System.out.println("Done!");
-        //if you want to run the demo manually, just comment following 2 lines
-        runAutoDec(); 
-    }
-    public void runAutoDec()
-    {
-    	Thread thread = new Thread() {
+    System.out.println ("Done!");
+    //if you want to run the demo manually, just comment following 2 lines
+    runAutoDec();
+  }
+  public void runAutoDec() {
+    Thread thread = new Thread() {
 
-			public void run()
-			{
-			Log.i(TAG,"decoder performance test begin");
-					
-			File bitstreams = new File(mStreamPath);
-			String[] list = bitstreams.list();
-			if(list==null || list.length==0)
-			{
-             Log.i(TAG,"have not find any coder resourse");           
-             finish();
-			}
-			for(int i=0;i<list.length;i++)
-			{				
-				
-			  String inFile=list[i];
-			  inFile = mStreamPath + inFile;
-			  String outFile=inFile +".yuv";
-			  DoDecoderTest(inFile, outFile);
-			  
-			 			  
-			}			
-			Log.i(TAG,"decoder performance test finish");			
-			finish();
-			}
+      public void run() {
+        Log.i (TAG, "decoder performance test begin");
 
-		};
-		thread.start();
-				
-    }
+        File bitstreams = new File (mStreamPath);
+        String[] list = bitstreams.list();
+        if (list == null || list.length == 0) {
+          Log.i (TAG, "have not find any coder resourse");
+          finish();
+        }
+        for (int i = 0; i < list.length; i++) {
 
-    @Override
-    public void onStart()
-    {
-        Log.i("WSE_DEC","welsdecdemo onStart");
-        super.onStart();
-    }
-    @Override
-    public void onDestroy()
-	{ 
-    	super.onDestroy();
-    	
-    	Log.i(TAG,"OnDestroy");
-    	
-		Process.killProcess(Process.myPid());
-	
-	}
+          String inFile = list[i];
+          inFile = mStreamPath + inFile;
+          String outFile = inFile + ".yuv";
+          DoDecoderTest (inFile, outFile);
 
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        switch (keyCode) {
-        case KeyEvent.KEYCODE_BACK:
-            return true;
-        default:
-            return super.onKeyDown(keyCode, event);
+
         }
+        Log.i (TAG, "decoder performance test finish");
+        finish();
+      }
+
+    };
+    thread.start();
+
+  }
+
+  @Override
+  public void onStart() {
+    Log.i ("WSE_DEC", "welsdecdemo onStart");
+    super.onStart();
+  }
+  @Override
+  public void onDestroy() {
+    super.onDestroy();
+
+    Log.i (TAG, "OnDestroy");
+
+    Process.killProcess (Process.myPid());
+
+  }
+
+  @Override
+  public boolean onKeyDown (int keyCode, KeyEvent event) {
+    switch (keyCode) {
+    case KeyEvent.KEYCODE_BACK:
+      return true;
+    default:
+      return super.onKeyDown (keyCode, event);
     }
+  }
 
-    public native void  DoDecoderTest(String infilename, String outfilename);
-    private static final String TAG = "welsdec";
-    static {
-        try {
-            System.loadLibrary("openh264");
-            System.loadLibrary("stlport_shared");
-            System.loadLibrary("welsdecdemo");
-            Log.v(TAG, "Load libwelsdec successful");
-        }
-        catch(Exception e) {
-            Log.e(TAG, "Failed to load welsdec"+e.getMessage());
-        }
+  public native void  DoDecoderTest (String infilename, String outfilename);
+  private static final String TAG = "welsdec";
+  static {
+    try {
+      System.loadLibrary ("openh264");
+      System.loadLibrary ("stlport_shared");
+      System.loadLibrary ("welsdecdemo");
+      Log.v (TAG, "Load libwelsdec successful");
+    } catch (Exception e) {
+      Log.e (TAG, "Failed to load welsdec" + e.getMessage());
     }
+  }
 }
 
--- a/codec/build/android/enc/src/com/wels/enc/WelsEncTest.java
+++ b/codec/build/android/enc/src/com/wels/enc/WelsEncTest.java
@@ -16,172 +16,158 @@
 import java.util.Vector;
 
 public class WelsEncTest extends Activity {
-    /** Called when the activity is first created. */
-    private OnClickListener OnClickEvent;
-    private Button mBtnLoad, mBtnStartSW;
+  /** Called when the activity is first created. */
+  private OnClickListener OnClickEvent;
+  private Button mBtnLoad, mBtnStartSW;
 
-    final String   mStreamPath = "/sdcard/welsenc/";
-    Vector<String> mCfgFiles = new Vector<String>();
+  final String   mStreamPath = "/sdcard/welsenc/";
+  Vector<String> mCfgFiles = new Vector<String>();
 
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        final TextView  tv = new TextView(this);
-        System.out.println("Here we go ...");
-        Log.i(TAG, "sdcard path:" + Environment.getExternalStorageDirectory().getAbsolutePath());
-        setContentView(R.layout.main);
+  @Override
+  public void onCreate (Bundle savedInstanceState) {
+    super.onCreate (savedInstanceState);
+    final TextView  tv = new TextView (this);
+    System.out.println ("Here we go ...");
+    Log.i (TAG, "sdcard path:" + Environment.getExternalStorageDirectory().getAbsolutePath());
+    setContentView (R.layout.main);
 
-        mBtnLoad = (Button)findViewById(R.id.cfg);
-        mBtnStartSW = (Button)findViewById(R.id.buttonSW);
+    mBtnLoad = (Button)findViewById (R.id.cfg);
+    mBtnStartSW = (Button)findViewById (R.id.buttonSW);
 
 
-        OnClickEvent = new OnClickListener()
-        {
-            public void onClick(View v)
-            {
-                switch(v.getId())
-                {
-                case R.id.cfg:
-                {
-                    String cfgFile = mStreamPath + "cfgs.txt";
-                    try {
-                        BufferedReader bufferedReader = new BufferedReader(new FileReader(cfgFile));
-                        String text;
-                        while((text = bufferedReader.readLine()) != null) {
-                            mCfgFiles.add(mStreamPath + text);
-                            Log.i(TAG, mStreamPath + text);
-                        }
-                        bufferedReader.close();
-                    } catch(IOException e) {
-                        Log.e(TAG, e.getMessage());
-                    }
-                }
-                break;
-                case R.id.buttonSW:
-                {
-                    System.out.println("encode sequence number = " + mCfgFiles.size());
-                    Log.i(TAG,"after click");
-                    try {
-                        for (int k=0; k < mCfgFiles.size(); k++) {
-                            String cfgFile =  mCfgFiles.get(k);
-                            DoEncoderTest(cfgFile);
-                        }
-                    } catch (Exception e) {
-                        Log.e(TAG, e.getMessage());
-                    }
-                    mCfgFiles.clear();
-                    tv.setText( "Encoder is completed!" );
-                }
-                break;
-                }
+    OnClickEvent = new OnClickListener() {
+      public void onClick (View v) {
+        switch (v.getId()) {
+        case R.id.cfg: {
+          String cfgFile = mStreamPath + "cfgs.txt";
+          try {
+            BufferedReader bufferedReader = new BufferedReader (new FileReader (cfgFile));
+            String text;
+            while ((text = bufferedReader.readLine()) != null) {
+              mCfgFiles.add (mStreamPath + text);
+              Log.i (TAG, mStreamPath + text);
+            }
+            bufferedReader.close();
+          } catch (IOException e) {
+            Log.e (TAG, e.getMessage());
+          }
+        }
+        break;
+        case R.id.buttonSW: {
+          System.out.println ("encode sequence number = " + mCfgFiles.size());
+          Log.i (TAG, "after click");
+          try {
+            for (int k = 0; k < mCfgFiles.size(); k++) {
+              String cfgFile =  mCfgFiles.get (k);
+              DoEncoderTest (cfgFile);
             }
-        };
+          } catch (Exception e) {
+            Log.e (TAG, e.getMessage());
+          }
+          mCfgFiles.clear();
+          tv.setText ("Encoder is completed!");
+        }
+        break;
+        }
+      }
+    };
 
-        mBtnLoad.setOnClickListener(OnClickEvent);
-        mBtnStartSW.setOnClickListener(OnClickEvent);
+    mBtnLoad.setOnClickListener (OnClickEvent);
+    mBtnStartSW.setOnClickListener (OnClickEvent);
 
-        System.out.println("Done!");
-        //run the test automatically,if you not want to autotest, just comment this line
-        runAutoEnc();
-    }
-    
-    public void runAutoEnc()
-    {
-    	Thread thread = new Thread() {
+    System.out.println ("Done!");
+    //run the test automatically,if you not want to autotest, just comment this line
+    runAutoEnc();
+  }
 
-			public void run()
-			{
-			Log.i(TAG,"encoder performance test begin");
-			String inYuvfile=null,outBitfile=null,inOrgfile=null,inLayerfile = null;						
-			File encCase = new File(mStreamPath);
-			String[] caseNum = encCase.list();
-			if(caseNum==null || caseNum.length==0)
-			{
-             Log.i(TAG,"have not find any encoder resourse");           
-             finish();
-			}
-	
-			for(int i=0;i<caseNum.length;i++)
-			{
-			  String[] yuvName = null;
-			  File yuvPath = null;			 
-			  File encCaseNo = new File(mStreamPath + caseNum[i]);			  
-			  String[] encFile = encCaseNo.list();
-			  
-			  for(int k=0;k<encFile.length;k++)
-			  {
-				  if(encFile[k].compareToIgnoreCase("welsenc.cfg") == 0)
-					 
-					  inOrgfile = encCaseNo + File.separator+encFile[k];
-				     
-				  else if(encFile[k].compareToIgnoreCase("layer2.cfg") == 0)
-					   inLayerfile = encCaseNo + File.separator+encFile[k];
-				  else if(encFile[k].compareToIgnoreCase("yuv") == 0)
-				  {
-					  yuvPath = new File(encCaseNo + File.separator+encFile[k]);					 
-					  yuvName = yuvPath.list();
-				  }
-			  }
-			  for(int m=0; m<yuvName.length;m++)
-			  {
-				  inYuvfile = yuvPath +File.separator+yuvName[m];
-				  outBitfile = inYuvfile +".264";
-				  Log.i(TAG,"enc yuv file:" + yuvName[m]);
-				  DoEncoderAutoTest(inOrgfile,inLayerfile,inYuvfile,outBitfile);
-			  }
-			}
-			  
-			Log.i(TAG,"encoder performance test finish");			
-			finish();
-			}
+  public void runAutoEnc() {
+    Thread thread = new Thread() {
 
-		};
-		thread.start();
-				
-    }
+      public void run() {
+        Log.i (TAG, "encoder performance test begin");
+        String inYuvfile = null, outBitfile = null, inOrgfile = null, inLayerfile = null;
+        File encCase = new File (mStreamPath);
+        String[] caseNum = encCase.list();
+        if (caseNum == null || caseNum.length == 0) {
+          Log.i (TAG, "have not find any encoder resourse");
+          finish();
+        }
 
-    @Override
-    public void onStart()
-    {
-        Log.i(TAG,"welsencdemo onStart");
-        super.onStart();
-    }
+        for (int i = 0; i < caseNum.length; i++) {
+          String[] yuvName = null;
+          File yuvPath = null;
+          File encCaseNo = new File (mStreamPath + caseNum[i]);
+          String[] encFile = encCaseNo.list();
 
-    @Override
-    public void onDestroy()
-	{ 
-    	super.onDestroy();
-    	
-    	Log.i(TAG,"OnDestroy");
-    	
-		Process.killProcess(Process.myPid());
-	
-	}
+          for (int k = 0; k < encFile.length; k++) {
+            if (encFile[k].compareToIgnoreCase ("welsenc.cfg") == 0)
 
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        switch (keyCode) {
-        case KeyEvent.KEYCODE_BACK:
-            return true;
-        default:
-            return super.onKeyDown(keyCode, event);
+              inOrgfile = encCaseNo + File.separator + encFile[k];
+
+            else if (encFile[k].compareToIgnoreCase ("layer2.cfg") == 0)
+              inLayerfile = encCaseNo + File.separator + encFile[k];
+            else if (encFile[k].compareToIgnoreCase ("yuv") == 0) {
+              yuvPath = new File (encCaseNo + File.separator + encFile[k]);
+              yuvName = yuvPath.list();
+            }
+          }
+          for (int m = 0; m < yuvName.length; m++) {
+            inYuvfile = yuvPath + File.separator + yuvName[m];
+            outBitfile = inYuvfile + ".264";
+            Log.i (TAG, "enc yuv file:" + yuvName[m]);
+            DoEncoderAutoTest (inOrgfile, inLayerfile, inYuvfile, outBitfile);
+          }
         }
+
+        Log.i (TAG, "encoder performance test finish");
+        finish();
+      }
+
+    };
+    thread.start();
+
+  }
+
+  @Override
+  public void onStart() {
+    Log.i (TAG, "welsencdemo onStart");
+    super.onStart();
+  }
+
+  @Override
+  public void onDestroy() {
+    super.onDestroy();
+
+    Log.i (TAG, "OnDestroy");
+
+    Process.killProcess (Process.myPid());
+
+  }
+
+  @Override
+  public boolean onKeyDown (int keyCode, KeyEvent event) {
+    switch (keyCode) {
+    case KeyEvent.KEYCODE_BACK:
+      return true;
+    default:
+      return super.onKeyDown (keyCode, event);
     }
+  }
 
-    public native void  DoEncoderTest(String cfgFileName);
-    public native void  DoEncoderAutoTest(String cfgFileName,String layerFileName,String yuvFileName,String outBitsName);
-    private static final String TAG = "welsenc";
-    static {
-        try {
-            System.loadLibrary("openh264");
-            System.loadLibrary("stlport_shared");
-            System.loadLibrary("welsencdemo");
-            Log.v(TAG, "Load libwelsencdemo.so successful");
-        }
-        catch(Exception e) {
-            Log.e(TAG, "Failed to load welsenc"+e.getMessage());
-        }
+  public native void  DoEncoderTest (String cfgFileName);
+  public native void  DoEncoderAutoTest (String cfgFileName, String layerFileName, String yuvFileName,
+                                         String outBitsName);
+  private static final String TAG = "welsenc";
+  static {
+    try {
+      System.loadLibrary ("openh264");
+      System.loadLibrary ("stlport_shared");
+      System.loadLibrary ("welsencdemo");
+      Log.v (TAG, "Load libwelsencdemo.so successful");
+    } catch (Exception e) {
+      Log.e (TAG, "Failed to load welsenc" + e.getMessage());
     }
+  }
 
 }
 
--- a/codec/build/iOS/dec/demo/demo/main.m
+++ b/codec/build/iOS/dec/demo/demo/main.m
@@ -34,96 +34,90 @@
 
 #import "DEMOAppDelegate.h"
 
-extern int DecMain(int argc, char * argv[]);
+extern int DecMain (int argc, char* argv[]);
 
 //redirect NSLog and stdout to logfile
-void redirectLogToDocumentFile()
-{
-    NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-    NSString *document = [path objectAtIndex:0];
-    NSString *fileName = [NSString stringWithFormat:@"decPerf.log"];
-    NSString *logPath = [document stringByAppendingPathComponent:fileName];
-    
-    NSFileManager *defaultManager = [NSFileManager defaultManager];
-    [defaultManager removeItemAtPath:logPath error:nil];
-    
-    freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stdout);
-    freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stderr);
+void redirectLogToDocumentFile() {
+  NSArray* path = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
+  NSString* document = [path objectAtIndex:0];
+  NSString* fileName = [NSString stringWithFormat:@"decPerf.log"];
+  NSString* logPath = [document stringByAppendingPathComponent:fileName];
+
+  NSFileManager* defaultManager = [NSFileManager defaultManager];
+  [defaultManager removeItemAtPath:logPath error:nil];
+
+  freopen ([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stdout);
+  freopen ([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stderr);
 }
 
 
 //run auto test to get encoder performance
-int AutoTestDec()
-{
-    
-    
-    NSString* document= [[NSString alloc] init];
-    NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-    if([paths count] == 0)
-    {
-        NSLog(@"could not find document path");
-        return 2;
+int AutoTestDec() {
+
+
+  NSString* document = [[NSString alloc] init];
+  NSArray* paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
+  if ([paths count] == 0) {
+    NSLog (@"could not find document path");
+    return 2;
+  }
+  document = [paths objectAtIndex:0];
+
+
+  NSString* decFilePath = [document stringByAppendingString:@"/DecoderPerfTestRes"];
+  NSFileManager* manage = [NSFileManager defaultManager];
+
+  NSString* outYuvPath = [decFilePath stringByAppendingString:@"/yuv"];
+  [manage removeItemAtPath:outYuvPath error:nil];
+  [manage createDirectoryAtPath:outYuvPath withIntermediateDirectories:YES attributes:nil error: nil];
+
+
+  NSArray* bitstreams = [manage subpathsAtPath:decFilePath];
+  if (bitstreams == nil) {
+    NSLog (@"could not find any bitstream under decoderperfpath");
+    return 1;
+  }
+
+  redirectLogToDocumentFile(); //output to console, just comment this line
+
+  for (int caseNO = 0; caseNO < [bitstreams count]; caseNO++) {
+
+    NSString* caseName = [bitstreams objectAtIndex:caseNO];
+    if ([caseName  isEqual: @"yuv"]) {
+      break;
     }
-    document = [paths objectAtIndex:0];
-    
-    
-    NSString* decFilePath =[document stringByAppendingString:@"/DecoderPerfTestRes"];
-    NSFileManager* manage=[NSFileManager defaultManager];
-    
-    NSString* outYuvPath=[decFilePath stringByAppendingString:@"/yuv"];
-    [manage removeItemAtPath:outYuvPath error:nil];
-    [manage createDirectoryAtPath:outYuvPath withIntermediateDirectories:YES attributes:nil error: nil];
-    
-    
-    NSArray* bitstreams=[manage subpathsAtPath:decFilePath];
-    if(bitstreams == nil)
-    {
-        NSLog(@"could not find any bitstream under decoderperfpath");
-        return 1;
-    }
-    
-    redirectLogToDocumentFile(); //output to console, just comment this line
-    
-    for (int caseNO=0; caseNO<[bitstreams count]; caseNO++)
-    {
-        
-        NSString* caseName = [bitstreams objectAtIndex:caseNO];
-        if ([caseName  isEqual: @"yuv"]) {
-            break;
-        }
-        NSString* bitstream = [decFilePath stringByAppendingString:@"/"];
-        bitstream = [bitstream stringByAppendingString:caseName];
-        NSString* yuvFileName = [caseName stringByAppendingString:@".yuv"];
-        NSString* tmpyuvFileName = [outYuvPath stringByAppendingString:@"/"];
-        yuvFileName = [tmpyuvFileName stringByAppendingString:yuvFileName];
-        
-        [manage createFileAtPath:yuvFileName contents:nil attributes:nil];
-        
-        const char* argvv[]={
-            "decConsole.exe",
-            [bitstream UTF8String],
-            [yuvFileName UTF8String]
-        };
-        DecMain(sizeof(argvv)/sizeof(argvv[0]), (char**)&argvv[0]);
-        fflush(stdout);// flush the content of stdout instantly
-    }
-    
-    
-    return 0;
+    NSString* bitstream = [decFilePath stringByAppendingString:@"/"];
+    bitstream = [bitstream stringByAppendingString:caseName];
+    NSString* yuvFileName = [caseName stringByAppendingString:@".yuv"];
+    NSString* tmpyuvFileName = [outYuvPath stringByAppendingString:@"/"];
+    yuvFileName = [tmpyuvFileName stringByAppendingString:yuvFileName];
+
+    [manage createFileAtPath:yuvFileName contents:nil attributes:nil];
+
+    const char* argvv[] = {
+      "decConsole.exe",
+      [bitstream UTF8String],
+      [yuvFileName UTF8String]
+    };
+    DecMain (sizeof (argvv) / sizeof (argvv[0]), (char**)&argvv[0]);
+    fflush (stdout); // flush the content of stdout instantly
+  }
+
+
+  return 0;
 }
 
-int main(int argc, char *argv[])
-{
-    //***For auto testing of decoder performance, call auto test here, if you not want to do auto test, you can comment it manualy
-    
-    if(AutoTestDec() == 0)
-        NSLog(@"Auto testing running sucessfully");
-    else
-        NSLog(@"Auto testing running failed");
-    abort();
-    //********
-    
-    @autoreleasepool {
-        return UIApplicationMain(argc, argv, nil, NSStringFromClass([DEMOAppDelegate class]));
-    }
+int main (int argc, char* argv[]) {
+  //***For auto testing of decoder performance, call auto test here, if you not want to do auto test, you can comment it manualy
+
+  if (AutoTestDec() == 0)
+    NSLog (@"Auto testing running sucessfully");
+  else
+    NSLog (@"Auto testing running failed");
+  abort();
+  //********
+
+  @autoreleasepool {
+    return UIApplicationMain (argc, argv, nil, NSStringFromClass ([DEMOAppDelegate class]));
+  }
 }
--- a/codec/build/iOS/enc/encDemo/encDemo/main.m
+++ b/codec/build/iOS/enc/encDemo/encDemo/main.m
@@ -35,149 +35,139 @@
 
 #import "AppDelegate.h"
 
-extern int EncMain(int argc, char **argv);
+extern int EncMain (int argc, char** argv);
 
 //redirect NSLog and stdout to logfile
-void redirectLogToDocumentFile()
-{
-    NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-    NSString *document = [path objectAtIndex:0];
-    NSString *fileName = [NSString stringWithFormat:@"encPerf.log"];
-    NSString *logPath = [document stringByAppendingPathComponent:fileName];
-    
-    NSFileManager *defaultManager = [NSFileManager defaultManager];
-    [defaultManager removeItemAtPath:logPath error:nil];
-    
-    freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stdout);
-    freopen([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stderr);
+void redirectLogToDocumentFile() {
+  NSArray* path = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
+  NSString* document = [path objectAtIndex:0];
+  NSString* fileName = [NSString stringWithFormat:@"encPerf.log"];
+  NSString* logPath = [document stringByAppendingPathComponent:fileName];
+
+  NSFileManager* defaultManager = [NSFileManager defaultManager];
+  [defaultManager removeItemAtPath:logPath error:nil];
+
+  freopen ([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stdout);
+  freopen ([logPath cStringUsingEncoding:NSASCIIStringEncoding], "a+", stderr);
 }
 
 //to judge whether the path is needed case path
-bool IsOneDeptDir(NSString* path)
-{
-    BOOL isDir = NO;
-    BOOL isOneDeptDir = NO;
-    NSFileManager* fileManager=[NSFileManager defaultManager];
-    NSArray* dirPathArray=[fileManager subpathsAtPath:path];
-    if([dirPathArray count]==0 || dirPathArray == nil)
-        isOneDeptDir = NO;
-    else
-    {
-        for (NSString* dirPath in dirPathArray){
-            NSString* tmpPath = [path stringByAppendingString:@"/"];
-            tmpPath = [tmpPath stringByAppendingString:dirPath];
-            [fileManager fileExistsAtPath:tmpPath isDirectory:&isDir];
-            if (isDir) {
-                isOneDeptDir = YES;
-                break;
-            }
-        }
+bool IsOneDeptDir (NSString* path) {
+  BOOL isDir = NO;
+  BOOL isOneDeptDir = NO;
+  NSFileManager* fileManager = [NSFileManager defaultManager];
+  NSArray* dirPathArray = [fileManager subpathsAtPath:path];
+  if ([dirPathArray count] == 0 || dirPathArray == nil)
+    isOneDeptDir = NO;
+  else {
+    for (NSString * dirPath in dirPathArray) {
+      NSString* tmpPath = [path stringByAppendingString:@"/"];
+      tmpPath = [tmpPath stringByAppendingString:dirPath];
+      [fileManager fileExistsAtPath:tmpPath isDirectory:&isDir];
+      if (isDir) {
+        isOneDeptDir = YES;
+        break;
+      }
     }
-    return isOneDeptDir;
+  }
+  return isOneDeptDir;
 }
 
 //run auto test to get encoder performance
-int AutoTestEnc()
-{
-    NSString* document= [[NSString alloc] init];
-    NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-    if([paths count] == 0)
-    {
-        NSLog(@"could not find document path");
-        return 2;
+int AutoTestEnc() {
+  NSString* document = [[NSString alloc] init];
+  NSArray* paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
+  if ([paths count] == 0) {
+    NSLog (@"could not find document path");
+    return 2;
+  }
+  document = [paths objectAtIndex:0];
+
+  NSString* encFilePath = [document stringByAppendingString:@"/EncoderPerfTestRes"];
+  NSFileManager* manage = [NSFileManager defaultManager];
+
+  NSArray* cases = [manage subpathsAtPath:encFilePath];
+  if (cases == nil) {
+    NSLog (@"could not find any test case under encoderperftest");
+    return 1;
+
+  }
+  redirectLogToDocumentFile();
+  NSMutableArray* dirArray = [[NSMutableArray alloc] init];
+  for (NSString * casePath in cases) {
+
+    NSString* path = [encFilePath stringByAppendingPathComponent:casePath];
+    if (IsOneDeptDir (path)) {
+      [dirArray addObject:casePath];
     }
-    document = [paths objectAtIndex:0];
-    
-    NSString* encFilePath =[document stringByAppendingString:@"/EncoderPerfTestRes"];
-    NSFileManager* manage=[NSFileManager defaultManager];
-    
-    NSArray* cases=[manage subpathsAtPath:encFilePath];
-    if(cases == nil)
-    {
-        NSLog(@"could not find any test case under encoderperftest");
-        return 1;
-        
+
+  }
+  for (int caseNO = 0; caseNO < [dirArray count]; caseNO++) {
+
+    NSString* caseName = [dirArray objectAtIndex:caseNO];
+    NSString* caseFilePath = [encFilePath stringByAppendingString:@"/"];
+    caseFilePath = [caseFilePath stringByAppendingString:caseName];
+    [manage changeCurrentDirectoryPath:[caseFilePath stringByExpandingTildeInPath]];
+
+    NSString* welscfg = [caseFilePath stringByAppendingString:@"/welsenc.cfg"];
+    NSString* layercfg = [caseFilePath stringByAppendingString:@"/layer2.cfg"];
+    NSString* yuvFilePath = [caseFilePath stringByAppendingString:@"/yuv"];
+    NSString* bitFilePath = [caseFilePath stringByAppendingString:@"/bit"];
+    [manage removeItemAtPath:bitFilePath error:nil];
+    [manage createDirectoryAtPath:bitFilePath withIntermediateDirectories:YES attributes:nil error:nil];
+
+
+    NSArray* files = [manage subpathsAtPath:yuvFilePath];
+
+    [manage changeCurrentDirectoryPath:[bitFilePath stringByExpandingTildeInPath]];
+
+    for (int i = 0; i < [files count]; i++) {
+      NSString* yuvFileName = [files objectAtIndex:i];
+      NSString* bitFileName = [yuvFileName stringByAppendingString:@".264"];
+
+      NSString*  bitFileNamePath = [bitFilePath stringByAppendingString:@"/"];
+      bitFileName = [bitFileNamePath stringByAppendingString:bitFileName];
+
+
+      [manage createFileAtPath:bitFileName contents:nil attributes:nil];
+      [manage changeCurrentDirectoryPath:[yuvFilePath stringByExpandingTildeInPath]];
+      const char* argvv[] = {
+        "dummy",
+        [welscfg UTF8String],
+        "-org",
+        [yuvFileName UTF8String],
+        "-bf",
+        [bitFileName UTF8String],
+        "-numl",
+        "1",
+        [layercfg UTF8String]
+      };
+
+      NSLog (@"WELS_INFO: enc config file: %@", welscfg);
+      NSLog (@"WELS_INFO: enc yuv file: %@", yuvFileName);
+      EncMain (sizeof (argvv) / sizeof (argvv[0]), (char**)&argvv[0]);
+      fflush (stdout); // flush the content of stdout instantly
     }
-    redirectLogToDocumentFile();
-    NSMutableArray *dirArray = [[NSMutableArray alloc] init];
-    for (NSString *casePath in cases) {
-        
-        NSString *path = [encFilePath stringByAppendingPathComponent:casePath];
-        if(IsOneDeptDir(path))
-        {
-            [dirArray addObject:casePath];
-        }
-        
-    }
-    for (int caseNO=0; caseNO<[dirArray count]; caseNO++)
-    {
-        
-        NSString* caseName = [dirArray objectAtIndex:caseNO];
-        NSString* caseFilePath = [encFilePath stringByAppendingString:@"/"];
-        caseFilePath = [caseFilePath stringByAppendingString:caseName];
-        [manage changeCurrentDirectoryPath:[caseFilePath stringByExpandingTildeInPath]];
-        
-        NSString* welscfg = [caseFilePath stringByAppendingString:@"/welsenc.cfg"];
-        NSString* layercfg = [caseFilePath stringByAppendingString:@"/layer2.cfg"];
-        NSString* yuvFilePath = [caseFilePath stringByAppendingString:@"/yuv"];
-        NSString* bitFilePath = [caseFilePath stringByAppendingString:@"/bit"];
-        [manage removeItemAtPath:bitFilePath error:nil];
-        [manage createDirectoryAtPath:bitFilePath withIntermediateDirectories:YES attributes:nil error:nil];
-        
-        
-        NSArray* files=[manage subpathsAtPath:yuvFilePath];
-        
-        [manage changeCurrentDirectoryPath:[bitFilePath stringByExpandingTildeInPath]];
-        
-        for(int i=0;i<[files count];i++)
-        {
-            NSString* yuvFileName = [files objectAtIndex:i];
-            NSString* bitFileName = [yuvFileName stringByAppendingString:@".264"];
-            
-            NSString*  bitFileNamePath = [bitFilePath stringByAppendingString:@"/"];
-            bitFileName = [bitFileNamePath stringByAppendingString:bitFileName];
-            
-            
-            [manage createFileAtPath:bitFileName contents:nil attributes:nil];
-            [manage changeCurrentDirectoryPath:[yuvFilePath stringByExpandingTildeInPath]];
-            const char* argvv[]={
-                "dummy",
-                [welscfg UTF8String],
-                "-org",
-                [yuvFileName UTF8String],
-                "-bf",
-                [bitFileName UTF8String],
-                "-numl",
-                "1",
-                [layercfg UTF8String]
-            };
-            
-            NSLog(@"WELS_INFO: enc config file: %@", welscfg);
-            NSLog(@"WELS_INFO: enc yuv file: %@", yuvFileName);
-            EncMain(sizeof(argvv)/sizeof(argvv[0]), (char**)&argvv[0]);
-            fflush(stdout);// flush the content of stdout instantly
-        }
-        
-    }
-    
-    
-    return 0;
+
+  }
+
+
+  return 0;
 }
 
 
-int main(int argc, char * argv[])
-{
-    
-    
-    //***For auto testing of encoder performance, call auto test here, if you not want to do auto test, you can comment it manualy
-    
-    if(AutoTestEnc() == 0)
-        NSLog(@"Auto testing running sucessfully");
-    else
-        NSLog(@"Auto testing running failed");
-    abort();
-    //************************
-    @autoreleasepool {
-        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
-    }
+int main (int argc, char* argv[]) {
+
+
+  //***For auto testing of encoder performance, call auto test here, if you not want to do auto test, you can comment it manualy
+
+  if (AutoTestEnc() == 0)
+    NSLog (@"Auto testing running sucessfully");
+  else
+    NSLog (@"Auto testing running failed");
+  abort();
+  //************************
+  @autoreleasepool {
+    return UIApplicationMain (argc, argv, nil, NSStringFromClass ([AppDelegate class]));
+  }
 }