genericopenlibs/liboil/tsrc/testsuite/ref/src/err8x8.c
author hgs
Thu, 05 Aug 2010 23:23:13 +0530
changeset 50 79045913e4e9
permissions -rw-r--r--
201031
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50
hgs
parents:
diff changeset
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     2
// All rights reserved.
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     7
//
hgs
parents:
diff changeset
     8
// Initial Contributors:
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    10
//
hgs
parents:
diff changeset
    11
// Contributors:
hgs
parents:
diff changeset
    12
//
hgs
parents:
diff changeset
    13
// Description:
hgs
parents:
diff changeset
    14
//
hgs
parents:
diff changeset
    15
hgs
parents:
diff changeset
    16
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#ifdef HAVE_CONFIG_H
hgs
parents:
diff changeset
    19
#include "config.h"
hgs
parents:
diff changeset
    20
#endif
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
#include <liboil/liboil.h>
hgs
parents:
diff changeset
    23
#include <liboil/liboilfunction.h>
hgs
parents:
diff changeset
    24
#include <stdio.h>
hgs
parents:
diff changeset
    25
#include <string.h>
hgs
parents:
diff changeset
    26
#include <globals.h>
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
#define LOG_FILE "c:\\logs\\testsuite_err8x8_log.txt"
hgs
parents:
diff changeset
    29
#include "std_log_result.h"
hgs
parents:
diff changeset
    30
#define LOG_FILENAME_LINE __FILE__, __LINE__
hgs
parents:
diff changeset
    31
#define MAX_SIZE 64
hgs
parents:
diff changeset
    32
#define RES_SIZE 1
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
void create_xml(int result)
hgs
parents:
diff changeset
    35
{
hgs
parents:
diff changeset
    36
    if(result)
hgs
parents:
diff changeset
    37
        assert_failed = 1;
hgs
parents:
diff changeset
    38
    
hgs
parents:
diff changeset
    39
    testResultXml("testsuite_err8x8");
hgs
parents:
diff changeset
    40
    close_log_file();
hgs
parents:
diff changeset
    41
}
hgs
parents:
diff changeset
    42
hgs
parents:
diff changeset
    43
hgs
parents:
diff changeset
    44
void test_err_intra8x8_u8()
hgs
parents:
diff changeset
    45
    {
hgs
parents:
diff changeset
    46
    uint8_t err1[MAX_SIZE];
hgs
parents:
diff changeset
    47
    uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={967680};
hgs
parents:
diff changeset
    48
    int i;
hgs
parents:
diff changeset
    49
    
hgs
parents:
diff changeset
    50
    for(i=0;i<MAX_SIZE;i++)
hgs
parents:
diff changeset
    51
          err1[i]=(i+2)*3;
hgs
parents:
diff changeset
    52
        
hgs
parents:
diff changeset
    53
    oil_err_intra8x8_u8(res, err1,2);
hgs
parents:
diff changeset
    54
    
hgs
parents:
diff changeset
    55
    std_log(LOG_FILENAME_LINE,"OUTPUT");
hgs
parents:
diff changeset
    56
    if(res[0] == check[0])
hgs
parents:
diff changeset
    57
        {
hgs
parents:
diff changeset
    58
         std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8 successful, res = %d", res[0]); 
hgs
parents:
diff changeset
    59
        }
hgs
parents:
diff changeset
    60
    else
hgs
parents:
diff changeset
    61
        {
hgs
parents:
diff changeset
    62
         assert_failed=1;
hgs
parents:
diff changeset
    63
         std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8 unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
hgs
parents:
diff changeset
    64
        }
hgs
parents:
diff changeset
    65
    }
hgs
parents:
diff changeset
    66
hgs
parents:
diff changeset
    67
hgs
parents:
diff changeset
    68
void test_err_inter8x8_u8()
hgs
parents:
diff changeset
    69
    {
hgs
parents:
diff changeset
    70
    uint8_t err1[MAX_SIZE],err2[MAX_SIZE];
hgs
parents:
diff changeset
    71
    uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={365568};
hgs
parents:
diff changeset
    72
    int i;
hgs
parents:
diff changeset
    73
    
hgs
parents:
diff changeset
    74
    for(i=0;i<MAX_SIZE;i++)
hgs
parents:
diff changeset
    75
        {
hgs
parents:
diff changeset
    76
          err1[i]=(i+2)*3;
hgs
parents:
diff changeset
    77
          err2[i]=(i+1)*2;
hgs
parents:
diff changeset
    78
        }
hgs
parents:
diff changeset
    79
    
hgs
parents:
diff changeset
    80
    oil_err_inter8x8_u8(res,err1,2,err2,1);
hgs
parents:
diff changeset
    81
    
hgs
parents:
diff changeset
    82
    if(res[0] == check[0])
hgs
parents:
diff changeset
    83
        {
hgs
parents:
diff changeset
    84
         std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8 successful, res = %d", res[0]); 
hgs
parents:
diff changeset
    85
        }
hgs
parents:
diff changeset
    86
    else
hgs
parents:
diff changeset
    87
        {
hgs
parents:
diff changeset
    88
         assert_failed=1;
hgs
parents:
diff changeset
    89
         std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8 unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
hgs
parents:
diff changeset
    90
        }
hgs
parents:
diff changeset
    91
    }
hgs
parents:
diff changeset
    92
hgs
parents:
diff changeset
    93
void test_err_inter8x8_u8_avg()
hgs
parents:
diff changeset
    94
    {
hgs
parents:
diff changeset
    95
    uint8_t err1[MAX_SIZE],err2[MAX_SIZE],err3[MAX_SIZE];
hgs
parents:
diff changeset
    96
    uint32_t res[RES_SIZE]={0}, check[RES_SIZE]={821248};
hgs
parents:
diff changeset
    97
    int i;
hgs
parents:
diff changeset
    98
    
hgs
parents:
diff changeset
    99
    for(i=0;i<MAX_SIZE;i++)
hgs
parents:
diff changeset
   100
        {
hgs
parents:
diff changeset
   101
          err1[i]=(i+2)*3;
hgs
parents:
diff changeset
   102
          err2[i]=(i+1)*2;
hgs
parents:
diff changeset
   103
          err3[i]=(i+1);
hgs
parents:
diff changeset
   104
        }
hgs
parents:
diff changeset
   105
    oil_err_inter8x8_u8_avg(res,err1,3,err2,err3,2);
hgs
parents:
diff changeset
   106
    if(res[0] == check[0])
hgs
parents:
diff changeset
   107
        {
hgs
parents:
diff changeset
   108
         std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg successful, res = %d", res[0]); 
hgs
parents:
diff changeset
   109
        }
hgs
parents:
diff changeset
   110
    else
hgs
parents:
diff changeset
   111
        {
hgs
parents:
diff changeset
   112
         assert_failed=1;
hgs
parents:
diff changeset
   113
         std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg unsuccessful, Expected =%d,Obtained =%d",check[0],res[0]);
hgs
parents:
diff changeset
   114
        }
hgs
parents:
diff changeset
   115
    }
hgs
parents:
diff changeset
   116
int main()
hgs
parents:
diff changeset
   117
    {
hgs
parents:
diff changeset
   118
    std_log(LOG_FILENAME_LINE,"Test started testsuite_err8x8");
hgs
parents:
diff changeset
   119
    oil_init ();
hgs
parents:
diff changeset
   120
hgs
parents:
diff changeset
   121
    std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8");
hgs
parents:
diff changeset
   122
    test_err_intra8x8_u8(); 
hgs
parents:
diff changeset
   123
hgs
parents:
diff changeset
   124
    std_log(LOG_FILENAME_LINE,"oil_err_inter8x8_u8");
hgs
parents:
diff changeset
   125
    test_err_inter8x8_u8();
hgs
parents:
diff changeset
   126
    
hgs
parents:
diff changeset
   127
    std_log(LOG_FILENAME_LINE,"oil_err_intra8x8_u8_avg");
hgs
parents:
diff changeset
   128
    test_err_inter8x8_u8_avg();
hgs
parents:
diff changeset
   129
    
hgs
parents:
diff changeset
   130
    
hgs
parents:
diff changeset
   131
    if(assert_failed)
hgs
parents:
diff changeset
   132
           std_log(LOG_FILENAME_LINE,"Test Fail");
hgs
parents:
diff changeset
   133
    else
hgs
parents:
diff changeset
   134
           std_log(LOG_FILENAME_LINE,"Test Successful");
hgs
parents:
diff changeset
   135
    create_xml(0);
hgs
parents:
diff changeset
   136
    return 0;
hgs
parents:
diff changeset
   137
    }