static int get_logical_cpus(AVCodecContext *avctx)

{

    int ret, nb_cpus = 1;

#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)

    cpu_set_t cpuset;



    CPU_ZERO(&cpuset);



    ret = sched_getaffinity(0, sizeof(cpuset), &cpuset);

    if (!ret) {

        nb_cpus = CPU_COUNT(&cpuset);

    }

#elif HAVE_GETSYSTEMINFO

    SYSTEM_INFO sysinfo;

    GetSystemInfo(&sysinfo);

    nb_cpus = sysinfo.dwNumberOfProcessors;

#elif HAVE_SYSCTL && defined(HW_NCPU)

    int mib[2] = { CTL_HW, HW_NCPU };

    size_t len = sizeof(nb_cpus);



    ret = sysctl(mib, 2, &nb_cpus, &len, NULL, 0);

    if (ret == -1)

        nb_cpus = 0;

#elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN)

    nb_cpus = sysconf(_SC_NPROC_ONLN);

#elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)

    nb_cpus = sysconf(_SC_NPROCESSORS_ONLN);

#endif

    av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);

    return FFMIN(nb_cpus, MAX_AUTO_THREADS);

}

static int get_logical_cpus(AVCodecContext *avctx)

{

    int ret, nb_cpus = 1;

#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)

    cpu_set_t cpuset;



    CPU_ZERO(&cpuset);



    ret = sched_getaffinity(0, sizeof(cpuset), &cpuset);

    if (!ret) {

        nb_cpus = CPU_COUNT(&cpuset);

    }

#elif HAVE_GETSYSTEMINFO

    SYSTEM_INFO sysinfo;

    GetSystemInfo(&sysinfo);

    nb_cpus = sysinfo.dwNumberOfProcessors;

#elif HAVE_SYSCTL && defined(HW_NCPU)

    int mib[2] = { CTL_HW, HW_NCPU };

    size_t len = sizeof(nb_cpus);



    ret = sysctl(mib, 2, &nb_cpus, &len, NULL, 0);

    if (ret == -1)

        nb_cpus = 0;

#elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN)

    nb_cpus = sysconf(_SC_NPROC_ONLN);

#elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)

    nb_cpus = sysconf(_SC_NPROCESSORS_ONLN);

#endif

    av_log(avctx, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);

    return FFMIN(nb_cpus, MAX_AUTO_THREADS);

}

static int FUNC_0(AVCodecContext *VAR_0)

{

    int VAR_1, VAR_2 = 1;

#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)

    cpu_set_t cpuset;



    CPU_ZERO(&cpuset);



    VAR_1 = sched_getaffinity(0, sizeof(cpuset), &cpuset);

    if (!VAR_1) {

        VAR_2 = CPU_COUNT(&cpuset);

    }

#elif HAVE_GETSYSTEMINFO

    SYSTEM_INFO sysinfo;

    GetSystemInfo(&sysinfo);

    VAR_2 = sysinfo.dwNumberOfProcessors;

#elif HAVE_SYSCTL && defined(HW_NCPU)

    int mib[2] = { CTL_HW, HW_NCPU };

    size_t len = sizeof(VAR_2);



    VAR_1 = sysctl(mib, 2, &VAR_2, &len, NULL, 0);

    if (VAR_1 == -1)

        VAR_2 = 0;

#elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN)

    VAR_2 = sysconf(_SC_NPROC_ONLN);

#elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)

    VAR_2 = sysconf(_SC_NPROCESSORS_ONLN);

#endif

    av_log(VAR_0, AV_LOG_DEBUG, "detected %d logical cores\n", VAR_2);

    return FFMIN(VAR_2, MAX_AUTO_THREADS);

}

static int FUNC_0(AVCodecContext *VAR_0)
{ int VAR_1, VAR_2 = 1; #if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)
cpu_set_t cpuset; CPU_ZERO(&cpuset); VAR_1 = sched_getaffinity(0, sizeof(cpuset), &cpuset); if (!VAR_1) { VAR_2 = CPU_COUNT(&cpuset); } #elif HAVE_GETSYSTEMINFO
SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); VAR_2 = sysinfo.dwNumberOfProcessors; #elif HAVE_SYSCTL && defined(HW_NCPU)
int mib[2] = { CTL_HW, HW_NCPU }; size_t len = sizeof(VAR_2); VAR_1 = sysctl(mib, 2, &VAR_2, &len, NULL, 0); if (VAR_1 == -1)
VAR_2 = 0; #elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN)
VAR_2 = sysconf(_SC_NPROC_ONLN); #elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)
VAR_2 = sysconf(_SC_NPROCESSORS_ONLN); #endif
av_log(VAR_0, AV_LOG_DEBUG, "detected %d logical cores\n", VAR_2); return FFMIN(VAR_2, MAX_AUTO_THREADS); }