GnuRadio-控件使用

1.QT GUI Range

 id是唯一的id;Lable是变量的id;default value必须再start和stop之间

2.RTL-SDR

3.Rational Resampler

 

重采样模块,Interpolation:内插倍数,Decimation:抽取倍数,输出采样率为:输入采样率*Interpolation/Decimation

4.Throttle

将输入限制到采样率再进行输出

5.Float To Char

将输入的Float乘以Scale后再通过四舍五入输出一个char。

 

int float_to_char_impl::work(int noutput_items,
                             gr_vector_const_void_star& input_items,
                             gr_vector_void_star& output_items)
{
    const float* in = (const float*)input_items[0];
    int8_t* out = (int8_t*)output_items[0];

    volk_32f_s32f_convert_8i(out, in, d_scale, d_vlen * noutput_items);

    return noutput_items;
}

static inline void volk_32f_s32f_convert_8i_generic(int8_t* outputVector,
                                                    const float* inputVector,
                                                    const float scalar,
                                                    unsigned int num_points)
{
    const float* inputVectorPtr = inputVector;

    for (unsigned int number = 0; number < num_points; number++) {
        const float r = *inputVectorPtr++ * scalar;
        volk_32f_s32f_convert_8i_single(&outputVector[number], r);
    }
}


static inline void volk_32f_s32f_convert_8i_single(int8_t* out, const float in)
{
    const float min_val = INT8_MIN;
    const float max_val = INT8_MAX;
    if (in > max_val) {
        *out = (int8_t)(max_val);
    } else if (in < min_val) {
        *out = (int8_t)(min_val);
    } else {
        *out = (int8_t)(rintf(in));
    }
}

 

 

 

 

 

posted @ 2023-03-24 23:09  朱小勇  阅读(145)  评论(0编辑  收藏  举报