What is "the instance structure must be manually initialized"?

Discussion in 'C Programming' started by fl, Jan 15, 2014.

  1. fl

    fl Guest

    Hi,

    I have big difficulties when I read below FIR function description.
    1. I do not know what is "4 different data type filter instance structures"

    2. I do not know What is "the instance structure must be manually initialized"

    The "statically initialize" is manual initialize? Or call function:

    ne10_result_t ne10_fir_init_float0 (ne10_fir_instance_f32_t * S,
    ne10_uint16_t numTaps,
    ne10_float32_t * pCoeffs,
    ne10_float32_t * pState,
    ne10_uint32_t blockSize)

    I have no idea at all on this question.


    Thanks a lot.



    --------------------------
    Initialization Functions
    There is also an associated initialization function for each data type.The initialization function performs the following operations:

    Sets the values of the internal structure fields.
    Zeros out the values in the state buffer.

    Use of the initialization function is optional. However, if the initialization function is used, then the instance structure cannot be placed intoa const data section. To place an instance structure into a const data section, the instance structure must be manually initialized. Set the values in the state buffer to zeros before static initialization. The code below statically initializes each of the 4 different data type filter instance structures

    ne10_fir_instance_f32_t S = {numTaps, pState, pCoeffs};
    ..............................
    ne10_result_t ne10_fir_init_float0 (ne10_fir_instance_f32_t * S,
    ne10_uint16_t numTaps,
    ne10_float32_t * pCoeffs,
    ne10_float32_t * pState,
    ne10_uint32_t blockSize)
    {
    /* Assign filter taps */
    S->numTaps = numTaps;

    /* Assign coefficient pointer */
    S->pCoeffs = pCoeffs;

    /* Clear state buffer and the size of state buffer is (blockSize + numTaps - 1) */
    memset (pState, 0, (numTaps + (blockSize - 1u)) * sizeof (ne10_float32_t));

    /* Assign state pointer */
    S->pState = pState;
    return NE10_OK;
    }
     
    fl, Jan 15, 2014
    #1
    1. Advertisements

  2. fl

    fl Guest

    Here is the FIR instance declaration. I do not see 4 different data type filter instance structures in it. Do you see something?

    Thanks.

    typedef struct
    {
    ne10_uint16_t numTaps; /**< Length of the filter. */
    ne10_float32_t *pState; /**< Points to the state variable array. Thearray is of length numTaps+maxBlockSize-1. */
    ne10_float32_t *pCoeffs; /**< Points to the coefficient array. The array is of length numTaps. */
    } ne10_fir_instance_f32_t;

    /**
     
    fl, Jan 15, 2014
    #2
    1. Advertisements

  3. fl

    Kaz Kylheku Guest

    The word "type" has a broader meaning than just "C language type", even
    in the context of C.

    Type is any aspect of a datum by which we categorize it, not
    only the declared type known to the compiler.
     
    Kaz Kylheku, Jan 15, 2014
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.