#include <stdio.h>
#include "dct.h"


// ********************************************************
int main() {
   short a[N], b[N], b_expected[N];
   int retval = 0, i;
   FILE *fp;

   fp=fopen("in.dat","r");
   for (i=0; i<N; i++){
      int tmp;
      fscanf(fp, "%d", &tmp);
      a[i] = tmp;
   }
   fclose(fp);

   fp=fopen("out.golden.dat","r");
   for (i=0; i<N; i++){
      int tmp;
      fscanf(fp, "%d", &tmp);
      b_expected[i] = tmp;
   }
   fclose(fp);

   dct(a, b);

   for (i = 0; i < N; ++i) {
      if(b[i] != b_expected[i]){
         printf("Incorrect output on sample %d. Expected %d, Received %d \n", i, b_expected[i], b[i]);
         retval = 2;
      }
   }

#if 0 // Optionally write out computed values
   fp=fopen("out.dat","w");
   for (i=0; i<N; i++){
      fprintf(fp, "%d\n", b[i]);
   }
   fclose(fp);
#endif

   if(retval != (2)){
      printf("    *** *** *** *** \n");
      printf("    Results are good \n");
      printf("    *** *** *** *** \n");
   } else {
      printf("    *** *** *** *** \n");
      printf("    BAD!! %d \n", retval);
      printf("    *** *** *** *** \n");
   }
   return retval;
}
//<copyright-disclaimer-start>
//  **************************************************************************************************************
//  * © 2026 Advanced Micro Devices, Inc. All rights reserved.                                                  *
//  * DISCLAIMER                                                                                                 *
//  * The information contained herein is for informational purposes only, and is subject to change              *
//  * without notice. While every precaution has been taken in the preparation of this document, it              *
//  * may contain technical inaccuracies, omissions and typographical errors, and AMD is under no                *
//  * obligation to update or otherwise correct this information.  Advanced Micro Devices, Inc. makes            *
//  * no representations or warranties with respect to the accuracy or completeness of the contents of           *
//  * this document, and assumes no liability of any kind, including the implied warranties of noninfringement,  *
//  * merchantability or fitness for particular purposes, with respect to the operation or use of AMD            *
//  * hardware, software or other products described herein.  No license, including implied or                   *
//  * arising by estoppel, to any intellectual property rights is granted by this document.  Terms and           *
//  * limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement   *
//  * between the parties or in AMD's Standard Terms and Conditions of Sale. GD-18                               *
//  *                                                                                                            *
//  **************************************************************************************************************
//<copyright-disclaimer-end>
