Пример #1
0
int
decode(SchroBuffer *buffer, int n, OilProfile *prof, int type)
{
  SchroArith *a;
  int i;
  int j;
  int x = 0;

  oil_profile_init (prof);
  for(j=0;j<10;j++){
    a = schro_arith_new();

    schro_arith_decode_init (a, buffer);

    switch (type) {
      case 0:
        oil_profile_start (prof);
        for(i=0;i<n;i++){
          x += orig_arith_decode_bit (a, 0);
        }
        oil_profile_stop (prof);
        break;
      case 1:
        oil_profile_start (prof);
        for(i=0;i<n;i++){
          x += ref_arith_decode_bit (a, 0);
        }
        oil_profile_stop (prof);
        break;
      case 2:
        oil_profile_start (prof);
        for(i=0;i<n;i++){
          x += test_arith_decode_bit (a, 0);
        }
        oil_profile_stop (prof);
        break;
    }

    a->buffer = NULL;
    schro_arith_free(a);
  }

  return x;
}
Пример #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;
}