Exemplo n.º 1
0
void InitializeNE10()
{
#if defined(__aarch64__)
    ne10_init_dsp(1);
#else
    /* Need to initialize things if we have Ne10 available */
    extern int omxSP_HasArmNeon();
    extern ne10_result_t ne10_init_dsp (ne10_int32_t is_NEON_available);
    ne10_init_dsp(omxSP_HasArmNeon());
#endif
}
Exemplo n.º 2
0
ne10_result_t ne10_init()
{
    ne10_result_t status = NE10_ERR;
#ifndef __MACH__
    FILE*   infofile = NULL;               // To open the file /proc/cpuinfo
    ne10_int8_t    cpuinfo[CPUINFO_BUFFER_SIZE];  // The buffer to read in the string
    ne10_uint32_t  bytes = 0;                     // Numbers of bytes read from the file
    ne10_int32_t     i = 0;                         // Temporary loop counter

    memset (cpuinfo, 0, CPUINFO_BUFFER_SIZE);
    infofile = fopen ("/proc/cpuinfo", "r");

    if (!infofile)
    {
        fprintf(stderr, "ERROR: couldn't read file \"/proc/cpuinfo\".\n");
        return NE10_ERR;
    }

    bytes    = fread (cpuinfo, 1, sizeof (cpuinfo), infofile);
    fclose (infofile);

    if (0 == bytes || CPUINFO_BUFFER_SIZE == bytes)
    {
        fprintf (stderr, "ERROR: Couldn't read the file \"/proc/cpuinfo\". NE10_init() failed.\n");
        return NE10_ERR;
    }

    while ('\0' != cpuinfo[i]) cpuinfo[i++] = (ne10_int8_t) tolower (cpuinfo[i]);

    if (0 != strstr ( (const char *)cpuinfo, "neon"))
    {
        is_NEON_available = NE10_OK;
    }
#else  //__MACH__
    is_NEON_available = NE10_OK;
#endif //__MACH__

#if defined (NE10_ENABLE_MATH)
    status = ne10_init_math (is_NEON_available);
    if (status != NE10_OK)
    {
        fprintf(stderr, "ERROR: init math failed\n");
        return NE10_ERR;
    }
#endif

#if defined (NE10_ENABLE_DSP)
    status = ne10_init_dsp (is_NEON_available);
    if (status != NE10_OK)
    {
        fprintf(stderr, "ERROR: init dsp failed\n");
        return NE10_ERR;
    }
#endif

#if defined (NE10_ENABLE_IMGPROC)
    status = ne10_init_imgproc (is_NEON_available);
    if (status != NE10_OK)
    {
        fprintf(stderr, "ERROR: init imgproc failed\n");
        return NE10_ERR;
    }
#endif

    return NE10_OK;
}