コード例 #1
0
ファイル: arith_speed.c プロジェクト: Distrotech/dirac
int
check (int n, int freq)
{
  SchroBuffer *buffer;
  OilProfile prof;
  double ave, std;
  int x;
  int y;

  buffer = schro_buffer_new_and_alloc (100000);

  encode(buffer, n, freq);

  print_speed();

  x = decode(buffer, n, &prof, 0);
  oil_profile_get_ave_std (&prof, &ave, &std);
  printf("orig %d,%d: %g (%g) %d\n", n, freq, ave, std, x);

  x = decode(buffer, n, &prof, 1);
  oil_profile_get_ave_std (&prof, &ave, &std);
  printf("ref  %d,%d: %g (%g) %d\n", n, freq, ave, std, x);

  y = decode(buffer, n, &prof, 2);
  oil_profile_get_ave_std (&prof, &ave, &std);
  printf("test %d,%d: %g (%g) %d\n", n, freq, ave, std, y);
  if (x != y) {
    printf("BROKEN\n");
  }

  schro_buffer_unref (buffer);

  return 0;
}
コード例 #2
0
int
main (int argc, char *argv[])
{
  SchroFrame *dest;
  SchroFrame *ref;
  SchroUpsampledFrame *uref;
  SchroParams params;
  SchroVideoFormat video_format;
  SchroMotionVector *motion_vectors;
  int i;
  int j;
  OilProfile prof;
  double ave, std;

  schro_init();

  video_format.width = 720;
  video_format.height = 480;
  video_format.chroma_format = SCHRO_CHROMA_420;
  schro_video_format_validate (&video_format);

  params.video_format = &video_format;
  params.xbsep_luma = 8;
  params.ybsep_luma = 8;
  params.xblen_luma = 12;
  params.yblen_luma = 12;

  schro_params_calculate_mc_sizes(&params);

  dest = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_S16_420,
      video_format.width, video_format.height);
  schro_frame_clear(dest);

  ref = schro_frame_new_and_alloc (NULL, SCHRO_FRAME_FORMAT_U8_420,
      video_format.width, video_format.height);
  schro_frame_clear(ref);

  uref = schro_upsampled_frame_new (ref);

  schro_upsampled_frame_upsample (uref);

  motion_vectors = malloc(sizeof(SchroMotionVector) *
      params.x_num_blocks * params.y_num_blocks);
  memset (motion_vectors, 0, sizeof(SchroMotionVector) *
      params.x_num_blocks * params.y_num_blocks);
  
  printf("sizeof(SchroMotionVector) = %lu\n",(unsigned long) sizeof(SchroMotionVector));
  printf("num blocks %d x %d\n", params.x_num_blocks, params.y_num_blocks);
  for(i=0;i<params.x_num_blocks*params.y_num_blocks;i++){
    motion_vectors[i].dx[0] = 0;
    motion_vectors[i].dy[0] = 0;
    motion_vectors[i].pred_mode = 1;
    motion_vectors[i].split = 2;
  }

  for(i=0;i<10;i++){
    oil_profile_init (&prof);
    for(j=0;j<10;j++){
      SchroMotion motion;

      motion.src1 = uref;
      motion.src2 = NULL;
      motion.motion_vectors = motion_vectors;
      motion.params = &params;
      oil_profile_start(&prof);
      schro_motion_render (&motion, dest);
      oil_profile_stop(&prof);
    }
    oil_profile_get_ave_std (&prof, &ave, &std);
    printf("cycles %g %g\n", ave, std);
  }



  schro_upsampled_frame_free (uref);
  schro_frame_unref (dest);
  free (motion_vectors);

  return 0;
}
コード例 #3
0
int
main(int argc, char *argv[])
{
  char *s=NULL, *d=NULL;
  uint32_t *src, *dest;
  int16_t res=0;
  OilProfile prof;
  double ave, std;
  int i,j, cnt;
  double cpufreq;
  OilFunctionClass *klass;
  OilFunctionImpl *impl;
  int the_class;
  
  std_log(LOG_FILENAME_LINE,"Test Started memcpy-speed");
  
  oil_init ();
  
  s = malloc(512*1024+1024);
  d = malloc(512*1024+1024);
//  src = ((void *)((unsigned long)(s) |  0xFF ));
  //dest = ((void *)((unsigned long)(d) |  0xFF ));
    src = ((void *)((unsigned long)(s) ));
  dest = ((void *)((unsigned long)(d) ));

  for(the_class=0; the_class<3; the_class++)
  { 
      cpufreq = 1788e6;    
      switch(the_class) {
        case 0:
          klass = oil_class_get ("splat_u32_ns");
          break;
        case 1:
          klass = oil_class_get ("copy_u8");
          break;
        case 2:
          klass = oil_class_get ("sum_s16");
          break;
      }
    
      for(impl=klass->first_impl;impl;impl=impl->next) {
      std_log(LOG_FILENAME_LINE,"impl %s\n", impl->name);
    
        if (!oil_impl_is_usable(impl)) {
        std_log(LOG_FILENAME_LINE,"  not usable\n");
          continue;
        }
    
        oil_class_choose_by_name (klass, impl->name);
    
        for(i=10;i<20;i++){
          oil_profile_init (&prof);
          for(j=0;j<10;j++){
            switch(the_class) {
              case 0:
                oil_profile_start(&prof);
                oil_splat_u32_ns (dest, src, 1<<(i-2));
                oil_profile_stop(&prof);
                for(cnt=0; cnt<(1<<(i-2)); cnt++){
                    if(dest[cnt]!=*src){
                        std_log(LOG_FILENAME_LINE,"Failed at the_class=%d, cnt=%d, i=%d, j=%d, impl->name=%s\n", the_class, cnt, i, j, impl->name);
                        assert_failed =1;
                    }
                }
                
                break;
              case 1:
                oil_profile_start(&prof);
                oil_memcpy (dest, src, 1<<i);
                oil_profile_stop(&prof);
                for(cnt=0; cnt<(1<<(i-2)); cnt++){      //cnt is checked with 1<<(i-2) because dest & src are of type uint32_t*
                    if(dest[cnt]!=src[cnt]){
                        std_log(LOG_FILENAME_LINE,"Failed at the_class=%d, cnt=%d, i=%d, j=%d, impl->name=%s\n", the_class, cnt, i, j, impl->name);
                        assert_failed =1;
                    }
                }
                
                break;
              case 2:
                  {
                int16_t* src1 = (int16_t*)src;
                int16_t* dest1 = (int16_t*)dest;
                oil_profile_start(&prof);
                oil_sum_s16 (dest1, src1, 1<<(i-1));
                oil_profile_stop(&prof);
                res=0;
                for(cnt=0; cnt<(1<<(i-1)); cnt++){
                    res += src1[cnt];
                }
                if(*dest1 != res){
                    std_log(LOG_FILENAME_LINE,"Failed at the_class=%d, impl->name=%s\n", the_class, impl->name);
                    assert_failed =1;
                }
                
                  }
                break;
            }
          }
          oil_profile_get_ave_std (&prof, &ave, &std);                    
          std_log(LOG_FILENAME_LINE,"%d: %10.4g %10.4g %10.4g\n", i, ave, std,
            ave/(1<<i));
          
        }
      }
      
 }
  free(s);
  free(d);
  
  if(!assert_failed)
      std_log(LOG_FILENAME_LINE, "Test Passed");
  else
      std_log(LOG_FILENAME_LINE, "Test Failed");
  create_xml(0);
  return 0;
}