os/ossrv/genericopenlibs/liboil/tsrc/testsuite/ref/src/err8x8.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/liboil/tsrc/testsuite/ref/src/err8x8.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,137 @@
     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_err8x8_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 +#define RES_SIZE 1
    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_err8x8");
    1.43 +    close_log_file();
    1.44 +}
    1.45 +
    1.46 +
    1.47 +void test_err_intra8x8_u8()
    1.48 +    {
    1.49 +    uint8_t err1[MAX_SIZE];
    1.50 +    uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={967680};
    1.51 +    int i;
    1.52 +    
    1.53 +    for(i=0;i<MAX_SIZE;i++)
    1.54 +          err1[i]=(i+2)*3;
    1.55 +        
    1.56 +    oil_err_intra8x8_u8(res, err1,2);
    1.57 +    
    1.58 +    std_log(LOG_FILENAME_LINE,"OUTPUT");
    1.59 +    if(res[0] == check[0])
    1.60 +        {
    1.61 +         std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8 successful, res = %d", res[0]); 
    1.62 +        }
    1.63 +    else
    1.64 +        {
    1.65 +         assert_failed=1;
    1.66 +         std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8 unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
    1.67 +        }
    1.68 +    }
    1.69 +
    1.70 +
    1.71 +void test_err_inter8x8_u8()
    1.72 +    {
    1.73 +    uint8_t err1[MAX_SIZE],err2[MAX_SIZE];
    1.74 +    uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={365568};
    1.75 +    int i;
    1.76 +    
    1.77 +    for(i=0;i<MAX_SIZE;i++)
    1.78 +        {
    1.79 +          err1[i]=(i+2)*3;
    1.80 +          err2[i]=(i+1)*2;
    1.81 +        }
    1.82 +    
    1.83 +    oil_err_inter8x8_u8(res,err1,2,err2,1);
    1.84 +    
    1.85 +    if(res[0] == check[0])
    1.86 +        {
    1.87 +         std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8 successful, res = %d", res[0]); 
    1.88 +        }
    1.89 +    else
    1.90 +        {
    1.91 +         assert_failed=1;
    1.92 +         std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8 unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
    1.93 +        }
    1.94 +    }
    1.95 +
    1.96 +void test_err_inter8x8_u8_avg()
    1.97 +    {
    1.98 +    uint8_t err1[MAX_SIZE],err2[MAX_SIZE],err3[MAX_SIZE];
    1.99 +    uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={821248};
   1.100 +    int i;
   1.101 +    
   1.102 +    for(i=0;i<MAX_SIZE;i++)
   1.103 +        {
   1.104 +          err1[i]=(i+2)*3;
   1.105 +          err2[i]=(i+1)*2;
   1.106 +          err3[i]=(i+1);
   1.107 +        }
   1.108 +    oil_err_inter8x8_u8_avg(res,err1,3,err2,err3,2);
   1.109 +    if(res[0] == check[0])
   1.110 +        {
   1.111 +         std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg successful, res = %d", res[0]); 
   1.112 +        }
   1.113 +    else
   1.114 +        {
   1.115 +         assert_failed=1;
   1.116 +         std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
   1.117 +        }
   1.118 +    }
   1.119 +int main()
   1.120 +    {
   1.121 +    std_log(LOG_FILENAME_LINE,"Test started testsuite_err8x8");
   1.122 +    oil_init ();
   1.123 +
   1.124 +    std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8");
   1.125 +    test_err_intra8x8_u8(); 
   1.126 +
   1.127 +    std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8");
   1.128 +    test_err_inter8x8_u8();
   1.129 +    
   1.130 +    std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg");
   1.131 +    test_err_inter8x8_u8_avg();
   1.132 +    
   1.133 +    
   1.134 +    if(assert_failed)
   1.135 +           std_log(LOG_FILENAME_LINE,"Test Fail");
   1.136 +    else
   1.137 +           std_log(LOG_FILENAME_LINE,"Test Successful");
   1.138 +    create_xml(0);
   1.139 +    return 0;
   1.140 +    }