|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 #ifdef HAVE_CONFIG_H |
|
19 #include "config.h" |
|
20 #endif |
|
21 |
|
22 #include <liboil/liboil.h> |
|
23 #include <liboil/liboilfunction.h> |
|
24 #include <stdio.h> |
|
25 #include <string.h> |
|
26 #include <globals.h> |
|
27 |
|
28 #define LOG_FILE "c:\\logs\\testsuite_misc8x8_log.txt" |
|
29 #include "std_log_result.h" |
|
30 #define LOG_FILENAME_LINE __FILE__, __LINE__ |
|
31 #define MAX_SIZE 64 |
|
32 |
|
33 |
|
34 void create_xml(int result) |
|
35 { |
|
36 if(result) |
|
37 assert_failed = 1; |
|
38 |
|
39 testResultXml("testsuite_misc8x8"); |
|
40 close_log_file(); |
|
41 } |
|
42 |
|
43 void test_clipconv8x8_u8_s16() |
|
44 { |
|
45 int16_t arr[MAX_SIZE]; |
|
46 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}; |
|
47 int i; |
|
48 |
|
49 for(i=0;i<MAX_SIZE;i++) |
|
50 { |
|
51 arr[i]=(i+1)*2; |
|
52 res[i]=0; |
|
53 } |
|
54 |
|
55 oil_clipconv8x8_u8_s16(res,3,arr,2); |
|
56 |
|
57 std_log(LOG_FILENAME_LINE,"OUTPUT"); |
|
58 |
|
59 for(i=0;i<MAX_SIZE;i++) |
|
60 if(res[i] == check[i]) |
|
61 { |
|
62 std_log(LOG_FILENAME_LINE,"oil_clipconv8x8_u8_s16 successful, res[%d] = %d", i,res[i]); |
|
63 } |
|
64 else |
|
65 { |
|
66 assert_failed=1; |
|
67 std_log(LOG_FILENAME_LINE,"oil_clipconv8x8_u8_s16 unsuccessful, Expected =%d,Obtained =%d",check[i],res[i]); |
|
68 } |
|
69 } |
|
70 |
|
71 |
|
72 void test_dequantize8x8_s16() |
|
73 { |
|
74 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}; |
|
75 int i; |
|
76 |
|
77 for(i=0;i<MAX_SIZE;i++) |
|
78 { |
|
79 arr1[i]=(i+1)*2; |
|
80 arr2[i]=i+2; |
|
81 res[i]=0; |
|
82 } |
|
83 |
|
84 oil_dequantize8x8_s16(res,1,arr1,2,arr2,1); |
|
85 |
|
86 for(i=0;i<MAX_SIZE;i++) |
|
87 if(res[i] == check[i]) |
|
88 { |
|
89 std_log(LOG_FILENAME_LINE,"oil_dequantize8x8_s16 successful, res[%d] = %d", i,res[i]); |
|
90 } |
|
91 else |
|
92 { |
|
93 assert_failed=1; |
|
94 std_log(LOG_FILENAME_LINE,"oil_dequantize8x8_s16 unsuccessful,Expected =%d,Obtained =%d",check[i],res[i]); |
|
95 } |
|
96 } |
|
97 |
|
98 |
|
99 int main() |
|
100 { |
|
101 std_log(LOG_FILENAME_LINE,"Test started testsuite_misc8x8"); |
|
102 oil_init (); |
|
103 |
|
104 std_log(LOG_FILENAME_LINE,"oil_clipconv8x8_u8_s16"); |
|
105 test_clipconv8x8_u8_s16(); |
|
106 |
|
107 std_log(LOG_FILENAME_LINE,"oil_dequantize8x8_s16"); |
|
108 test_dequantize8x8_s16(); |
|
109 |
|
110 if(assert_failed) |
|
111 std_log(LOG_FILENAME_LINE,"Test Fail"); |
|
112 else |
|
113 std_log(LOG_FILENAME_LINE,"Test Successful"); |
|
114 create_xml(0); |
|
115 return 0; |
|
116 } |