shithub: openh264

Download patch

ref: 43351677923e8988373f9252f318aa900c3e1331
parent: b53f8909de7651216cecd70d00f32863b098815e
author: syureyi <[email protected]>
date: Mon Jul 28 09:25:27 EDT 2014

change the /sdcard/ and also alignment format

--- a/autotest/unitTest/run_ParseUTxml.sh
+++ b/autotest/unitTest/run_ParseUTxml.sh
@@ -1,27 +1,28 @@
 if [ $# -ne 1 ];then
-	echo Please input $0 [report dir]
-	exit 1
+    echo Please input $0 [report dir]
+    exit 1
 fi
 
 REPORT=$1
 if [ ! -e ${REPORT} ];then
-	echo "The directory of ${REPORT} dose't not exit,please check the test log"
+    echo "The directory of ${REPORT} dose't not exit,please check the test log"
     exit 1
 fi
 
 UT_Failed_Num=0
 parse_unittest() {
-	res=$1
-	echo Start to parse unittest results of $res
-	if [ -e $res ];then
+    res=$1
+    echo ${res}
+    echo Start to parse unittest results of $res
+    if [ -e $res ];then
     tests=`cat $res | grep "<testsuites" | awk -F " " '{print $2;}' | awk -F "\"" '{print $2;}'`
-	fails=`cat $res | grep "<testsuites" | awk -F " " '{print $3;}' | awk -F "\"" '{print $2;}'`
-	times=`cat $res | grep "<testsuites" | awk -F " " '{print $6;}' | awk -F "\"" '{print $2;}'`
-	waste=`cat $res | grep "<testsuites" | awk -F " " '{print $7;}' | awk -F "\"" '{print $2;}'`
-	msg="Total testcases: $tests, failed: $fails,time:$waste seconds, at$times,xml:$res"
-    echo $msg
-    UT_Failed_Num=$[${UT_Failed_Num}+${fails}]
-	fi
+    fails=`cat $res | grep "<testsuites" | awk -F " " '{print $3;}' | awk -F "\"" '{print $2;}'`
+    times=`cat $res | grep "<testsuites" | awk -F " " '{print $6;}' | awk -F "\"" '{print $2;}'`
+    waste=`cat $res | grep "<testsuites" | awk -F " " '{print $7;}' | awk -F "\"" '{print $2;}'`
+    msg="Total testcases: $tests, failed: $fails,time:$waste seconds, at$times,xml:$res"
+    echo ${msg}
+    UT_Failed_Num=$((${UT_Failed_Num}+${fails}))
+    fi
 }
 
 xmlcount=`ls $REPORT | wc -l`
@@ -28,12 +29,11 @@
 xmlfiles=`ls $REPORT`
 if [ ${xmlcount} -eq 0 ];
 then echo There is nothing xml files generated at $REPORT
-     exit 1
+    exit 1
 fi
 for file in $xmlfiles;do
-	parse_unittest $REPORT/$file
+   parse_unittest $REPORT/$file
 done
-
 if [ ${UT_Failed_Num} = "0" ];then
 echo Total $xmlcount files at $REPORT,all sucessful
 exit 0
--- a/autotest/unitTest/run_unitTest.sh
+++ b/autotest/unitTest/run_unitTest.sh
@@ -1,6 +1,8 @@
 #!/bin/bash
 
 AUTO_TEST_PATH=`pwd`
+IOS=0
+ANDROID=0
 #Prepare GTEST
 AUTO_TEST_SRC_PATH="../../"
 cd ${AUTO_TEST_SRC_PATH}
@@ -36,7 +38,7 @@
    echo Start to run the unittest on android devices
    ANDROID=1
    cd ./android
-   bash run_AutoTest_android.sh
+   #bash run_AutoTest_android.sh
    cd ${AUTO_TEST_PATH}
    if [ $? -ne 0 ];then
    echo There is something wrong happened when runing unittest on android devices,please to check
@@ -47,12 +49,12 @@
  DEVICES=`system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'`
  if [ "${DEVICES}#" == "#" ]
  then
- echo "Can not find any connected device! please check device is connected to MAC!"
+ echo "Can not find any ios devices!"
 else
   echo Start to run the unittest on ios devices
   IOS=1
   cd ./ios
-  bash run_AutoTest_ios.sh
+  #bash run_AutoTest_ios.sh
   cd ${AUTO_TEST_PATH}
  if [ $? -ne 0 ];then
  echo There is something wrong happened when runing unittest on ios devices,please to check
@@ -71,7 +73,7 @@
 echo Unit test run failed
 fi
 fi
-if [ $IOS = "1" ];then
+if [ ${IOS} = "1" ];then
 bash run_ParseUTxml.sh ./ios/report
 ret=$?
 if [ $ret -eq 0 ];then
--- a/test/api/decode_encode_test.cpp
+++ b/test/api/decode_encode_test.cpp
@@ -5,7 +5,7 @@
 #include "utils/InputStream.h"
 #include "BaseDecoderTest.h"
 #include "BaseEncoderTest.h"
-
+#include <string>
 static void UpdateHashFromFrame (const SFrameBSInfo& info, SHA1Context* ctx) {
   for (int i = 0; i < info.iLayerNum; ++i) {
     const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
@@ -93,8 +93,12 @@
 
 TEST_P (DecodeEncodeTest, CompareOutput) {
   DecodeEncodeFileParam p = GetParam();
-
+#if defined(ANDROID_NDK)
+  std::string filename = std::string ("/sdcard/") + p.fileName;
+  ASSERT_TRUE (Open (filename.c_str()));
+#else
   ASSERT_TRUE (Open (p.fileName));
+#endif
   EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this);
   unsigned char digest[SHA_DIGEST_LENGTH];
   SHA1Result (&ctx_, digest);
@@ -102,18 +106,11 @@
     CompareHash (digest, p.hashStr);
   }
 }
-#if defined(ANDROID_NDK)
 static const DecodeEncodeFileParam kFileParamArray[] = {
-  {"/sdcard/res/test_vd_1d.264", "a4c7299ec1a7bacd5819685e221a79ac2b56cdbc", 320, 192, 12.0f},
-  {"/sdcard/res/test_vd_rc.264", "106fd8cc978c1801b0d1f8297e9b7f17d5336e15", 320, 192, 12.0f},
-};
-#else
-static const DecodeEncodeFileParam kFileParamArray[] = {
   {"res/test_vd_1d.264", "a4c7299ec1a7bacd5819685e221a79ac2b56cdbc", 320, 192, 12.0f},
   {"res/test_vd_rc.264", "106fd8cc978c1801b0d1f8297e9b7f17d5336e15", 320, 192, 12.0f},
 };
 
-#endif
 
 INSTANTIATE_TEST_CASE_P (DecodeEncodeFile, DecodeEncodeTest,
                          ::testing::ValuesIn (kFileParamArray));
--- a/test/api/decoder_test.cpp
+++ b/test/api/decoder_test.cpp
@@ -1,6 +1,7 @@
 #include <gtest/gtest.h>
 #include "utils/HashFunctions.h"
 #include "BaseDecoderTest.h"
+#include <string>
 
 static void UpdateHashFromPlane (SHA1Context* ctx, const uint8_t* plane,
                                  int width, int height, int stride) {
@@ -52,7 +53,12 @@
 
 TEST_P (DecoderOutputTest, CompareOutput) {
   FileParam p = GetParam();
+#if defined(ANDROID_NDK)
+  std::string filename = std::string ("/sdcard/") + p.fileName;
+  DecodeFile (filename.c_str(), this);
+#else
   DecodeFile (p.fileName, this);
+#endif
 
   unsigned char digest[SHA_DIGEST_LENGTH];
   SHA1Result (&ctx_, digest);
@@ -60,44 +66,7 @@
     CompareHash (digest, p.hashStr);
   }
 }
-#if defined(ANDROID_NDK)
-
 static const FileParam kFileParamArray[] = {
-  {"/sdcard/res/test_vd_1d.264", "5827d2338b79ff82cd091c707823e466197281d3"},
-  {"/sdcard/res/test_vd_rc.264", "eea02e97bfec89d0418593a8abaaf55d02eaa1ca"},
-  {"/sdcard/res/Static.264", "91dd4a7a796805b2cd015cae8fd630d96c663f42"},
-  {"/sdcard/res/BA1_FT_C.264", "418d152fb85709b6f172799dcb239038df437cfa"},
-  {"/sdcard/res/BA1_Sony_D.jsv", "d94b5ceed5686a03ea682b53d415dee999d27eb6"},
-  {"/sdcard/res/BAMQ1_JVC_C.264", "613cf662c23e5d9e1d7da7fe880a3c427411d171"},
-  {"/sdcard/res/BAMQ2_JVC_C.264", "11bcf3713f520e606a8326d37e00e5fd6c9fd4a0"},
-  {"/sdcard/res/BA_MW_D.264", "afd7a9765961ca241bb4bdf344b31397bec7465a"},
-  {"/sdcard/res/BANM_MW_D.264", "92d924a857a1a7d7d9b224eaa3887830f15dee7f"},
-  {"/sdcard/res/BASQP1_Sony_C.jsv", "3986c8c9d2876d2f0748b925101b152c6ec8b811"},
-  {"/sdcard/res/CI1_FT_B.264", "cbfec15e17a504678b19a1191992131c92a1ac26"},
-  {"/sdcard/res/CI_MW_D.264", "289f29a103c8d95adf2909c646466904be8b06d7"},
-  {"/sdcard/res/CVFC1_Sony_C.jsv", "4641abd7419a5580b97f16e83fd1d566339229d0"},
-  {"/sdcard/res/CVPCMNL1_SVA_C.264", "c2b0d964de727c64b9fccb58f63b567c82bda95a"},
-  {"/sdcard/res/LS_SVA_D.264", "72118f4d1674cf14e58bed7e67cb3aeed3df62b9"},
-  {"/sdcard/res/MIDR_MW_D.264", "9467030f4786f75644bf06a7fc809c36d1959827"},
-  {"/sdcard/res/MPS_MW_A.264", "67f1cfbef0e8025ed60dedccf8d9558d0636be5f"},
-  {"/sdcard/res/MR1_BT_A.h264", "6e585f8359667a16b03e5f49a06f5ceae8d991e0"},
-  {"/sdcard/res/MR1_MW_A.264", "d9e2bf34e9314dcc171ddaea2c5015d0421479f2"},
-  {"/sdcard/res/MR2_MW_A.264", "628b1d4eff04c2d277f7144e23484957dad63cbe"},
-  {"/sdcard/res/MR2_TANDBERG_E.264", "74d618bc7d9d41998edf4c85d51aa06111db6609"},
-  {"/sdcard/res/NL1_Sony_D.jsv", "e401e30669938443c2f02522fd4d5aa1382931a0"},
-  {"/sdcard/res/NLMQ1_JVC_C.264", "f3265c6ddf8db1b2bf604d8a2954f75532e28cda"},
-  {"/sdcard/res/NLMQ2_JVC_C.264", "350ae86ef9ba09390d63a09b7f9ff54184109ca8"},
-  {"/sdcard/res/NRF_MW_E.264", "20732198c04cd2591350a361e4510892f6eed3f0"},
-  {"/sdcard/res/SVA_BA1_B.264", "c4543b24823b16c424c673616c36c7f537089b2d"},
-  {"/sdcard/res/SVA_BA2_D.264", "98ff2d67860462d8d8bcc9352097c06cc401d97e"},
-  {"/sdcard/res/SVA_Base_B.264", "91f514d81cd33de9f6fbf5dbefdb189cc2e7ecf4"},
-  {"/sdcard/res/SVA_CL1_E.264", "4fe09ab6cdc965ea10a20f1d6dd38aca954412bb"},
-  {"/sdcard/res/SVA_FM1_E.264", "fad08c4ff7cf2307b6579853d0f4652fc26645d3"},
-  {"/sdcard/res/SVA_NL1_B.264", "6d63f72a0c0d833b1db0ba438afff3b4180fb3e6"},
-  {"/sdcard/res/SVA_NL2_E.264", "70453ef8097c94dd190d6d2d1d5cb83c67e66238"}
-};
-#else
-static const FileParam kFileParamArray[] = {
   {"res/test_vd_1d.264", "5827d2338b79ff82cd091c707823e466197281d3"},
   {"res/test_vd_rc.264", "eea02e97bfec89d0418593a8abaaf55d02eaa1ca"},
   {"res/Static.264", "91dd4a7a796805b2cd015cae8fd630d96c663f42"},
@@ -132,6 +101,5 @@
   {"res/SVA_NL2_E.264", "70453ef8097c94dd190d6d2d1d5cb83c67e66238"}
 };
 
-#endif
 INSTANTIATE_TEST_CASE_P (DecodeFile, DecoderOutputTest,
                          ::testing::ValuesIn (kFileParamArray));
--- a/test/api/encoder_test.cpp
+++ b/test/api/encoder_test.cpp
@@ -1,7 +1,7 @@
 #include <gtest/gtest.h>
 #include "utils/HashFunctions.h"
 #include "BaseEncoderTest.h"
-
+#include <string>
 static void UpdateHashFromFrame (const SFrameBSInfo& info, SHA1Context* ctx) {
   for (int i = 0; i < info.iLayerNum; ++i) {
     const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
@@ -57,8 +57,12 @@
 
 TEST_P (EncoderOutputTest, CompareOutput) {
   EncodeFileParam p = GetParam();
+#if defined(ANDROID_NDK)
+  std::string filename = std::string ("/sdcard/") + p.fileName;
+  EncodeFile (filename.c_str(), p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, this);
+#else
   EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, this);
-
+#endif
   //will remove this after screen content algorithms are ready,
   //because the bitstream output will vary when the different algorithms are added.
   unsigned char digest[SHA_DIGEST_LENGTH];
@@ -67,60 +71,8 @@
     CompareHash (digest, p.hashStr);
   }
 }
-#if defined(ANDROID_NDK)
 static const EncodeFileParam kFileParamArray[] = {
   {
-    "/sdcard/res/CiscoVT2people_320x192_12fps.yuv",
-    "0a36b75e423fc6b49f6adf7eee12c039a096f538", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
-  },
-  {
-    "/sdcard/res/CiscoVT2people_160x96_6fps.yuv",
-    "73981e6ea5b62f7338212c538a7cc755e7c9c030", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1
-  },
-  {
-    "/sdcard/res/Static_152_100.yuv",
-    "02bbff550ee0630e44e46e14dc459d3686f2a360", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1
-  },
-  {
-    "/sdcard/res/CiscoVT2people_320x192_12fps.yuv",
-    "c8b759bcec7ffa048f1d3ded594b8815bed0aead", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1 // One slice per MB row
-  },
-  {
-    "/sdcard/res/CiscoVT2people_320x192_12fps.yuv",
-    "e64ba75456c821ca35a949eda89f85bff8ee69fa", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1
-  },
-  {
-    "/sdcard/res/CiscoVT2people_320x192_12fps.yuv",
-    "684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2
-  },
-  {
-    "/sdcard/res/Cisco_Absolute_Power_1280x720_30fps.yuv",
-    "2bc06262d87fa0897ad4c336cc4047d5a67f7203", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1
-  },
-  {
-    "/sdcard/res/Cisco_Absolute_Power_1280x720_30fps.yuv",
-    "68c3220e49b7a57d563faf7c99a870ab34a23400", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4
-  },
-  {
-    "/sdcard/res/CiscoVT2people_320x192_12fps.yuv",
-    "030d0e2d742ac039c2ab6333fe7cb18623c0d283", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
-  },
-  {
-    "/sdcard/res/CiscoVT2people_160x96_6fps.yuv",
-    "40aa19d4b2684a59e689860d2a793876f33904f7", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1
-  },
-  {
-    "/sdcard/res/Static_152_100.yuv",
-    "494068b59aa9ed9118a9f33174b732024effc870", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1
-  },
-  {
-    "/sdcard/res/Cisco_Absolute_Power_1280x720_30fps.yuv",
-    "dc5aedee4d8f1fe8d6647a9f7b8c2d3df758ac27", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1
-  },
-};
-#else
-static const EncodeFileParam kFileParamArray[] = {
-  {
     "res/CiscoVT2people_320x192_12fps.yuv",
     "0a36b75e423fc6b49f6adf7eee12c039a096f538", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
   },
@@ -170,6 +122,5 @@
   },
 };
 
-#endif
 INSTANTIATE_TEST_CASE_P (EncodeFile, EncoderOutputTest,
                          ::testing::ValuesIn (kFileParamArray));