This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于旋转因子对齐

在PROCESSOR_SDK_VISION_03_05_00_00\ti_components\algorithms\dsplib_c66x_3_4_0_0\docs\DSPLIB_Users_Manual.chm说明手册里面讲到,

Arrays pointed by ptr_x, ptr_w, and ptr_y should align on the double words boundary 这个是说按双字对齐还是什么意思?

相应的文件里面有这个伪指令:#pragma DATA_ALIGN(w_spr_fft, 8);

就我所学的关于字节对齐的知识,在结构体当中如果按8字节对齐,那么char short int 应该都是按照8字节计算其存储空间,请问假设我定义

#pragma DATA_ALIGN(w_spr_fft, 8);
float w_spr_fft [2*32]; 那么我的w_spr_fft 占用的空间是64个float么?还是说64个8字节?请ti大佬回答,多谢!

  • align on the double words boundary 这个是说按双字对齐。

    #pragma DATA_ALIGN(w_spr_fft, 8)是8字节对齐,也就是说w_spr_fft地址的末尾3位是0, w_spr_fft 数据类型float还是占据64个float。
  • 您好,张工。我还有个关于双字对齐的问题。我在Ti给的例程中发现,调用ti自带的fft函数需要输入输出和旋转因子全部按照双字对齐。Ti给的example是在main 函数的那个文件里面定义了输入输出以及旋转因子,写成如下:(x_sp是输入,y_sp是输出, w_sp是旋转因子)
    #pragma DATA_ALIGN(x_sp, 8);
    float x_sp [2*N];
    #pragma DATA_ALIGN(y_sp, 8);
    float y_sp [2*N];
    #pragma DATA_ALIGN(w_sp, 8);
    float w_sp [2*N];

    假设1:我需要在某个函数里面进行fft,需要用到动态分配空间malloc函数。我会写语句:float * x_sp = (float*)malloc(......);请问我是把那条伪指令写在这条语句上方么? 还是我只能用全局变量进行字节对齐?
    #pragma DATA_ALIGN(x_sp, 8);
    float * x_sp = (float*)malloc(......);

    假设2:我在global.c 中定义了一个全局变量g_y[2*N](float g_y[2*N];),在对应的global.h中声明其为全局变量(extern float g_y[2*N];)请问我这个双字对齐的伪指令加在.c文件 还是.h文件该变量的上方还是两个文件都要加?