1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/liboil/tsrc/testsuite/jpeg/src/misc8x8.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,116 @@
1.4 +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +
1.21 +#ifdef HAVE_CONFIG_H
1.22 +#include "config.h"
1.23 +#endif
1.24 +
1.25 +#include <liboil/liboil.h>
1.26 +#include <liboil/liboilfunction.h>
1.27 +#include <stdio.h>
1.28 +#include <string.h>
1.29 +#include <globals.h>
1.30 +
1.31 +#define LOG_FILE "c:\\logs\\testsuite_misc8x8_log.txt"
1.32 +#include "std_log_result.h"
1.33 +#define LOG_FILENAME_LINE __FILE__, __LINE__
1.34 +#define MAX_SIZE 64
1.35 +
1.36 +
1.37 +void create_xml(int result)
1.38 +{
1.39 + if(result)
1.40 + assert_failed = 1;
1.41 +
1.42 + testResultXml("testsuite_misc8x8");
1.43 + close_log_file();
1.44 +}
1.45 +
1.46 +void test_clipconv8x8_u8_s16()
1.47 + {
1.48 + int16_t arr[MAX_SIZE];
1.49 + uint8_t res[MAX_SIZE], check[MAX_SIZE]={2,4,6,4,6,8,6,8,10,8,10,12,10,12,14,12,14,16,14,16,18,16,18,20,22,24,26,28,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1.50 + int i;
1.51 +
1.52 + for(i=0;i<MAX_SIZE;i++)
1.53 + {
1.54 + arr[i]=(i+1)*2;
1.55 + res[i]=0;
1.56 + }
1.57 +
1.58 + oil_clipconv8x8_u8_s16(res,3,arr,2);
1.59 +
1.60 + std_log(LOG_FILENAME_LINE,"OUTPUT");
1.61 +
1.62 + for(i=0;i<MAX_SIZE;i++)
1.63 + if(res[i] == check[i])
1.64 + {
1.65 + std_log(LOG_FILENAME_LINE,"oil_clipconv8x8_u8_s16 successful, res[%d] = %d", i,res[i]);
1.66 + }
1.67 + else
1.68 + {
1.69 + assert_failed=1;
1.70 + std_log(LOG_FILENAME_LINE,"oil_clipconv8x8_u8_s16 unsuccessful, Expected =%d,Obtained =%d",check[i],res[i]);
1.71 + }
1.72 + }
1.73 +
1.74 +
1.75 +void test_dequantize8x8_s16()
1.76 + {
1.77 + int16_t arr1[MAX_SIZE],arr2[MAX_SIZE],res[MAX_SIZE],check[MAX_SIZE]={4,18,40,70,96,126,160,198,240,30,80,134,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1.78 + int i;
1.79 +
1.80 + for(i=0;i<MAX_SIZE;i++)
1.81 + {
1.82 + arr1[i]=(i+1)*2;
1.83 + arr2[i]=i+2;
1.84 + res[i]=0;
1.85 + }
1.86 +
1.87 + oil_dequantize8x8_s16(res,1,arr1,2,arr2,1);
1.88 +
1.89 + for(i=0;i<MAX_SIZE;i++)
1.90 + if(res[i] == check[i])
1.91 + {
1.92 + std_log(LOG_FILENAME_LINE,"oil_dequantize8x8_s16 successful, res[%d] = %d", i,res[i]);
1.93 + }
1.94 + else
1.95 + {
1.96 + assert_failed=1;
1.97 + std_log(LOG_FILENAME_LINE,"oil_dequantize8x8_s16 unsuccessful,Expected =%d,Obtained =%d",check[i],res[i]);
1.98 + }
1.99 + }
1.100 +
1.101 +
1.102 +int main()
1.103 + {
1.104 + std_log(LOG_FILENAME_LINE,"Test started testsuite_misc8x8");
1.105 + oil_init ();
1.106 +
1.107 + std_log(LOG_FILENAME_LINE,"oil_clipconv8x8_u8_s16");
1.108 + test_clipconv8x8_u8_s16();
1.109 +
1.110 + std_log(LOG_FILENAME_LINE,"oil_dequantize8x8_s16");
1.111 + test_dequantize8x8_s16();
1.112 +
1.113 + if(assert_failed)
1.114 + std_log(LOG_FILENAME_LINE,"Test Fail");
1.115 + else
1.116 + std_log(LOG_FILENAME_LINE,"Test Successful");
1.117 + create_xml(0);
1.118 + return 0;
1.119 + }