os/ossrv/genericopenlibs/liboil/tsrc/testsuite/ref/src/recon8x8.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/recon8x8.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,143 @@
     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_recon8x8_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 +void create_xml(int result)
    1.37 +{
    1.38 +    if(result)
    1.39 +        assert_failed = 1;
    1.40 +    
    1.41 +    testResultXml("testsuite_recon8x8");
    1.42 +    close_log_file();
    1.43 +}
    1.44 +
    1.45 +void test_recon8x8_intra()
    1.46 +    {
    1.47 +    int16_t src[MAX_SIZE];
    1.48 +    uint8_t dest[MAX_SIZE],check[MAX_SIZE]={138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201};
    1.49 +    int i;
    1.50 +    
    1.51 +    for(i=0;i<MAX_SIZE;i++)
    1.52 +        {
    1.53 +         src[i]=i+10;
    1.54 +         dest[i]=0;
    1.55 +        }
    1.56 +    oil_recon8x8_intra(dest,8,src);
    1.57 +    
    1.58 +    for(i=0;i<MAX_SIZE;i++)
    1.59 +        if(check[i] == dest[i])
    1.60 +            {
    1.61 +            std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra successful, dest[%d] = %d",i,dest[i]);
    1.62 +            }
    1.63 +        else
    1.64 +            {
    1.65 +            assert_failed=1;
    1.66 +            std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra unsuccessful, Expected =%d,Obtained =%d",check[i],dest[i]);
    1.67 +            }
    1.68 +    }
    1.69 +
    1.70 +
    1.71 +void test_recon8x8_inter()
    1.72 +    {
    1.73 +    int16_t src2[MAX_SIZE];
    1.74 +    uint8_t src1[MAX_SIZE],dest[MAX_SIZE],check[MAX_SIZE]={5,7,9,11,13,15,17,19,15,17,19,21,23,25,27,29,25,27,29,31,33,35,37,39,35,37,39,41,43,45,47,49,45,47,49,51,53,55,57,59,55,57,59,61,63,65,67,69,65,67,69,71,73,75,77,79,75,77,79,81,83,85,87,89};
    1.75 +    int i;
    1.76 +    
    1.77 +    for(i=0;i<MAX_SIZE;i++)
    1.78 +        {
    1.79 +         src1[i]=i+3;
    1.80 +         src2[i]=i+2;
    1.81 +         dest[i]=0;
    1.82 +        }
    1.83 +    oil_recon8x8_inter(dest,8,src1,2,src2);
    1.84 +    
    1.85 +    for(i=0;i<MAX_SIZE;i++)
    1.86 +        if(check[i] == dest[i])
    1.87 +            {
    1.88 +            std_log(LOG_FILENAME_LINE,"oil_recon8x8_inter successful, dest[%d] = %d",i,dest[i]);
    1.89 +            }
    1.90 +        else
    1.91 +            {
    1.92 +            assert_failed=1;
    1.93 +            std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra unsuccessful, Expected =%d,Obtained =%d",check[i],dest[i]);
    1.94 +            }
    1.95 +    }
    1.96 +
    1.97 +void test_recon8x8_inter2()
    1.98 +    {
    1.99 +    uint8_t src1[MAX_SIZE],src2[MAX_SIZE];
   1.100 +    int16_t src3[MAX_SIZE];
   1.101 +    uint8_t dest[MAX_SIZE],check[MAX_SIZE]={2,4,6,8,10,12,14,16,12,14,16,18,20,22,24,26,21,23,25,27,29,31,33,35,31,33,35,37,39,41,43,45,40,42,44,46,48,50,52,54,50,52,54,56,58,60,62,64,59,61,63,65,67,69,71,73,69,71,73,75,77,79,81,83};
   1.102 +    int i;
   1.103 +    
   1.104 +    for(i=0;i<MAX_SIZE;i++)
   1.105 +        {
   1.106 +         src1[i]=i+3;
   1.107 +         src2[i]=i+2;
   1.108 +         src3[i]=i;
   1.109 +         dest[i]=0;
   1.110 +        }
   1.111 +    oil_recon8x8_inter2(dest,8,src1,2,src2,1,src3);
   1.112 +    
   1.113 +    for(i=0;i<MAX_SIZE;i++)
   1.114 +        if(check[i] == dest[i])
   1.115 +            {
   1.116 +            std_log(LOG_FILENAME_LINE,"oil_recon8x8_inter2 successful, dest[%d] = %d",i,dest[i]);
   1.117 +            }
   1.118 +        else
   1.119 +            {
   1.120 +            assert_failed=1;
   1.121 +            std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra unsuccessful, Expected =%d,Obtained =%d",check[i],dest[i]);
   1.122 +            }
   1.123 +    }
   1.124 +
   1.125 +
   1.126 +int main()
   1.127 +    {
   1.128 +    std_log(LOG_FILENAME_LINE,"Test started testsuite_recon8x8");
   1.129 +    oil_init ();
   1.130 +    
   1.131 +    std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra");
   1.132 +    test_recon8x8_intra();
   1.133 +    
   1.134 +    std_log(LOG_FILENAME_LINE,"oil_recon8x8_inter");
   1.135 +    test_recon8x8_inter();
   1.136 +    
   1.137 +    std_log(LOG_FILENAME_LINE,"oil_recon8x8_inter2");
   1.138 +    test_recon8x8_inter2();
   1.139 +    
   1.140 +    if(assert_failed)
   1.141 +           std_log(LOG_FILENAME_LINE,"Test Fail");
   1.142 +    else
   1.143 +           std_log(LOG_FILENAME_LINE,"Test Successful");
   1.144 +    create_xml(0);
   1.145 +    return 0;
   1.146 +    }