/* * Copyright (C) Texas Instruments - http://www.ti.com/ * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* ============================================================================== * Texas Instruments OMAP (TM) Platform Software * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved. * * Use of this software is controlled by the terms and conditions found * in the license agreement under which this software has been supplied. * ============================================================================ */ /** * @file SkLibTiJpeg_Test.cpp * * This test program will be used to test the JPEG decoder and encoder * from libskia level. * */ #include #include "SkLibTiJpeg_Test.h" #include "SkTime.h" #ifdef ANDROID #include #endif extern "C" { #include "md5.h" }; #define LIBSKIAHWTEST "[SkLibTiJpeg_Test_Script]" #define PASS 0 #define FAIL 1 #define ERROR -1 #define PRINT printf //enable this for additional debug prints. //#define DEBUG 1 //#define TIME_MEASUREMENT 1 #ifdef DEBUG #define DBGPRINT printf #else #define DBGPRINT #endif #define BUFSIZE (1024 * 8) #define MD5_SUM_LENGTH 16 #define JPGD_MD5SUM_LIST 0 #define JPGE_MD5SUM_LIST 1 #define PASSCOUNT_ARM 0 #define PASSCOUNT_TIDSP 1 #define PASSCOUNT_SIMCOP 2 #define FAILCOUNT 3 #define COUNT_MANUALVERIFY 4 #define COUNT_MAX_INDEX 5 #define CODECTYPE_SW 0 #define CODECTYPE_DSP 1 #define CODECTYPE_SIMCOP 2 //test case count unsigned int nTestCount[5]; //[0]-ARM; [1]-TI; //[2]-SIMCOP; [3]-Fail count; //[4]-manual verification needed int flagDumpMd5Sum; int flagCodecType; //0- SW codec ( ARM) //1- TI DSP codec //2- SIMCOP codec FILE* pFileDump; //for dumping the md5sum strings char testID[40]; //------------------------------------------------------------------------------------ #ifdef TIME_MEASUREMENT class AutoTimeMillis { public: AutoTimeMillis(const char label[]) : fLabel(label) { if (!fLabel) { fLabel = ""; } fNow = SkTime::GetMSecs(); } ~AutoTimeMillis() { PRINT("---- Input file Resolution :%dx%d",width,height); PRINT("---- JPEG Time (ms): %s %d\n", fLabel, SkTime::GetMSecs() - fNow); } void setResolution(int width, int height){ this->width=width; this->height=height; } private: const char* fLabel; SkMSec fNow; int width; int height; }; #endif //----------------------------------------------------------------------------- void printDecoderTestUsage() { PRINT("\nDecoder Test parameters:\n"); PRINT("SkLibTiJpeg_Test \n\n","%"); PRINT(" = D-Decoder test\n"); PRINT(" = .jpg file name\n"); PRINT("= .raw file name\n"); PRINT(" = Output color format: 4-16bit_RBG565, 6-32bit_ARGB8888\n"); PRINT(" = Scalefactor: 100, 50, 25, 12 percent\n","%"); PRINT(" = SliceOutput Mode: Number of rows per slice\n"); PRINT(" = Sub Region Decode: X-origin\n"); PRINT(" = Sub Region Decode: Y-origin\n"); PRINT(" = Sub Region Decode: X-Length\n"); PRINT(" = Sub Region Decode: Y-Length\n"); PRINT("= Scale Factor number(OMAP4->1-256; OMAP3->1,2,4,8) OR User's desired output Width\n"); PRINT(" = User's desired output Height.\n"); PRINT("\nNOTE: nUserW * nUserH : if nUserW alone given it will be taken as scaleFactor value.\n"); PRINT(" if both values are given then the scale factor is calculated based on valid values of them\n"); PRINT(" if both value are valid then the scale factor will be calculated using nUserW\n"); PRINT(" if nUserW = 0 and nUserH > 0 then the scale factor will be calculated using nUserH\n"); } //End of printDecoderTestUsage() //----------------------------------------------------------------------------- void printEncoderTestUsage() { PRINT("\nEncoder Test parameters:\n"); PRINT("SkLibTiJpeg_Test \n\n"); PRINT(" = E-Encoder test\n"); PRINT(" = .raw file name\n"); PRINT("= .jpg file name\n"); PRINT(" = Input color format: 4-16bit_RBG565, 6-32bit_ARGB8888\n"); PRINT(" = Quality factor: 1-100\n"); } //End of printEncoderTestUsage() //----------------------------------------------------------------------------- void printInputScriptFormat() { PRINT("\nUsing Script/Folder:\n"); PRINT("SkLibTiJpeg_Test <[M][C]>