os/ossrv/genericopenlibs/liboil/tsrc/testsuite/ref/src/err8x8.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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_err8x8_log.txt"
    29 #include "std_log_result.h"
    30 #define LOG_FILENAME_LINE __FILE__, __LINE__
    31 #define MAX_SIZE 64
    32 #define RES_SIZE 1
    33 
    34 void create_xml(int result)
    35 {
    36     if(result)
    37         assert_failed = 1;
    38     
    39     testResultXml("testsuite_err8x8");
    40     close_log_file();
    41 }
    42 
    43 
    44 void test_err_intra8x8_u8()
    45     {
    46     uint8_t err1[MAX_SIZE];
    47     uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={967680};
    48     int i;
    49     
    50     for(i=0;i<MAX_SIZE;i++)
    51           err1[i]=(i+2)*3;
    52         
    53     oil_err_intra8x8_u8(res, err1,2);
    54     
    55     std_log(LOG_FILENAME_LINE,"OUTPUT");
    56     if(res[0] == check[0])
    57         {
    58          std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8 successful, res = %d", res[0]); 
    59         }
    60     else
    61         {
    62          assert_failed=1;
    63          std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8 unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
    64         }
    65     }
    66 
    67 
    68 void test_err_inter8x8_u8()
    69     {
    70     uint8_t err1[MAX_SIZE],err2[MAX_SIZE];
    71     uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={365568};
    72     int i;
    73     
    74     for(i=0;i<MAX_SIZE;i++)
    75         {
    76           err1[i]=(i+2)*3;
    77           err2[i]=(i+1)*2;
    78         }
    79     
    80     oil_err_inter8x8_u8(res,err1,2,err2,1);
    81     
    82     if(res[0] == check[0])
    83         {
    84          std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8 successful, res = %d", res[0]); 
    85         }
    86     else
    87         {
    88          assert_failed=1;
    89          std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8 unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
    90         }
    91     }
    92 
    93 void test_err_inter8x8_u8_avg()
    94     {
    95     uint8_t err1[MAX_SIZE],err2[MAX_SIZE],err3[MAX_SIZE];
    96     uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={821248};
    97     int i;
    98     
    99     for(i=0;i<MAX_SIZE;i++)
   100         {
   101           err1[i]=(i+2)*3;
   102           err2[i]=(i+1)*2;
   103           err3[i]=(i+1);
   104         }
   105     oil_err_inter8x8_u8_avg(res,err1,3,err2,err3,2);
   106     if(res[0] == check[0])
   107         {
   108          std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg successful, res = %d", res[0]); 
   109         }
   110     else
   111         {
   112          assert_failed=1;
   113          std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
   114         }
   115     }
   116 int main()
   117     {
   118     std_log(LOG_FILENAME_LINE,"Test started testsuite_err8x8");
   119     oil_init ();
   120 
   121     std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8");
   122     test_err_intra8x8_u8(); 
   123 
   124     std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8");
   125     test_err_inter8x8_u8();
   126     
   127     std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg");
   128     test_err_inter8x8_u8_avg();
   129     
   130     
   131     if(assert_failed)
   132            std_log(LOG_FILENAME_LINE,"Test Fail");
   133     else
   134            std_log(LOG_FILENAME_LINE,"Test Successful");
   135     create_xml(0);
   136     return 0;
   137     }