zoukankan      html  css  js  c++  java
  • 指针

    int Rawdata_PreProcess(void * ptr_rawdata_addr_header[],int N,int data_length,void *out_data)
    {
    
       //int rpp_valid_flag = -1;
       int temp_length = 0;
       temp_length = data_length;//>>1;
       int32_t *temp_buff = new int32_t[temp_length];
    
       uint64_t *ptr_rawdata_addr_header_buff = new uint64_t[N];
    
    
       //copy N frames rawdata header addr to a buff
       uint64_t * temp = ptr_rawdata_addr_header_buff;
       for(int i=0; i<N; i++){
           *temp = *(uint64_t *)ptr_rawdata_addr_header++;
           qDebug() << * (uint16_t *) *temp;
           temp++;
       }
    
       //a
       for (int i=0; i<temp_length; i++){
           *temp_buff++ = 0;
       }
    
       // sum all rawdata
       temp = ptr_rawdata_addr_header_buff;
    
       for(int j = 0;j < temp_length; j++){
           for(int i = 0; i< N; i++){
    
                temp_buff[j] += * (uint16_t *)(temp[i] + j);
           }
           qDebug()<<"sum"<<j<<"="<<temp_buff[j];
       }
    
    
    #if 0
       //
       uint32_t * ptr_rawdata;
       ptr_rawdata = rawdata;
    
       for(int j = 0;j < temp_length; j++){
           for(int i = 0; i< N; i++){
                temp_buff += ** ptr_rawdata;
                temp_buff ++;
                ptr_rawdata ++;
                qDebug()<<"temp_buff"<<temp_buff;
                qDebug()<<"ptr_rawdata"<<ptr_rawdata;
           }
    
       }
    
    
       for(int i= 0;i < N;i++)
       {
            out_data  =(int16_t*) rawdata[i];
            for(int j = 0;j < temp_length; j++)
            {
                 temp_buff[j] += ((int16_t*)out_data)[j];
            }
            rpp_valid_flag++;
       }
    
       if(rpp_valid_flag)
       {
           for(int m = 0; m < temp_length;m++)
           {
                temp_buff_new[m] = int16_t(temp_buff[m]/N);
           }
    
    
           rpp_valid_flag = 1;
       }
    
    
       delete[] temp_buff;
       delete[] temp_buff_new;
       return rpp_valid_flag;
    #endif
    }
    
    
    int main(int argc, char *argv[])
    {
    
        int16_t a1[]= {1, 2, 3, 4, 5, 6};
        int16_t a2[]= {10, 20, 30, 40, 50, 60};
        int16_t a3[]= {100, 200, 300, 400, 500, 600};
        int16_t a4[]= {1000, 2000, 3000, 4000, 5000, 6000};
        void * ms_data[]={a1, a2, a3, a4};
        int16_t * out_data[6];
  • 相关阅读:
    ES6之Promise封装ajax()
    ECMAScript 6 入门之 展开运算符(...)
    函数篇:Callback----回调函数
    Vue-cli组件中写一个节流函数
    使用vant中的地址编辑组件
    js中substr()、substring()、chatAt()的区别
    npm使用国内淘宝镜像的方法
    js数组
    ECMAScript版本
    匿名函数的调用
  • 原文地址:https://www.cnblogs.com/hjj-fighting/p/10773729.html
Copyright © 2011-2022 走看看