os/ossrv/genericopenlibs/liboil/tsrc/testsuite/ref/src/recon8x8.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_recon8x8_log.txt"
    29 #include "std_log_result.h"
    30 #define LOG_FILENAME_LINE __FILE__, __LINE__
    31 #define MAX_SIZE 64
    32 
    33 void create_xml(int result)
    34 {
    35     if(result)
    36         assert_failed = 1;
    37     
    38     testResultXml("testsuite_recon8x8");
    39     close_log_file();
    40 }
    41 
    42 void test_recon8x8_intra()
    43     {
    44     int16_t src[MAX_SIZE];
    45     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};
    46     int i;
    47     
    48     for(i=0;i<MAX_SIZE;i++)
    49         {
    50          src[i]=i+10;
    51          dest[i]=0;
    52         }
    53     oil_recon8x8_intra(dest,8,src);
    54     
    55     for(i=0;i<MAX_SIZE;i++)
    56         if(check[i] == dest[i])
    57             {
    58             std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra successful, dest[%d] = %d",i,dest[i]);
    59             }
    60         else
    61             {
    62             assert_failed=1;
    63             std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra unsuccessful, Expected =%d,Obtained =%d",check[i],dest[i]);
    64             }
    65     }
    66 
    67 
    68 void test_recon8x8_inter()
    69     {
    70     int16_t src2[MAX_SIZE];
    71     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};
    72     int i;
    73     
    74     for(i=0;i<MAX_SIZE;i++)
    75         {
    76          src1[i]=i+3;
    77          src2[i]=i+2;
    78          dest[i]=0;
    79         }
    80     oil_recon8x8_inter(dest,8,src1,2,src2);
    81     
    82     for(i=0;i<MAX_SIZE;i++)
    83         if(check[i] == dest[i])
    84             {
    85             std_log(LOG_FILENAME_LINE,"oil_recon8x8_inter successful, dest[%d] = %d",i,dest[i]);
    86             }
    87         else
    88             {
    89             assert_failed=1;
    90             std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra unsuccessful, Expected =%d,Obtained =%d",check[i],dest[i]);
    91             }
    92     }
    93 
    94 void test_recon8x8_inter2()
    95     {
    96     uint8_t src1[MAX_SIZE],src2[MAX_SIZE];
    97     int16_t src3[MAX_SIZE];
    98     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};
    99     int i;
   100     
   101     for(i=0;i<MAX_SIZE;i++)
   102         {
   103          src1[i]=i+3;
   104          src2[i]=i+2;
   105          src3[i]=i;
   106          dest[i]=0;
   107         }
   108     oil_recon8x8_inter2(dest,8,src1,2,src2,1,src3);
   109     
   110     for(i=0;i<MAX_SIZE;i++)
   111         if(check[i] == dest[i])
   112             {
   113             std_log(LOG_FILENAME_LINE,"oil_recon8x8_inter2 successful, dest[%d] = %d",i,dest[i]);
   114             }
   115         else
   116             {
   117             assert_failed=1;
   118             std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra unsuccessful, Expected =%d,Obtained =%d",check[i],dest[i]);
   119             }
   120     }
   121 
   122 
   123 int main()
   124     {
   125     std_log(LOG_FILENAME_LINE,"Test started testsuite_recon8x8");
   126     oil_init ();
   127     
   128     std_log(LOG_FILENAME_LINE,"oil_recon8x8_intra");
   129     test_recon8x8_intra();
   130     
   131     std_log(LOG_FILENAME_LINE,"oil_recon8x8_inter");
   132     test_recon8x8_inter();
   133     
   134     std_log(LOG_FILENAME_LINE,"oil_recon8x8_inter2");
   135     test_recon8x8_inter2();
   136     
   137     if(assert_failed)
   138            std_log(LOG_FILENAME_LINE,"Test Fail");
   139     else
   140            std_log(LOG_FILENAME_LINE,"Test Successful");
   141     create_xml(0);
   142     return 0;
   143     }