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