[FFmpeg-devel] [PATCH] Runtime detection for the number of processors/cores

Philipp Meinen philipp
Wed May 21 18:24:01 CEST 2008


On Wednesday 21 May 2008 18.18:41 Fran?ois Revol wrote:
> > The function av_get_processor_num is now located in new
> > cpu.[hc] files under libavutil.
>
> There is *no* reason to create a file just for this.
> As the code is platform dependant and threading related it should
> go to the existing platform-specific files libavcodec/*thread.c
>
> Unless you need it from libavutils (then those should be moved to
> it).
>
> Just declare av_get_num_processors() (or get_processor_count, but
> "get_processor_num" is semantically different, it means "get (the)
> processor number (but which number, ID ?)) in avcodec.h since other
> thread funcs are there.

I did as I have been told by S. Sabatini :)
But I can of course change the name and location in the next patch.

>
> > I added some checks to the configure script to check for
> > <sched.h> and <windows.h> .
>
> sched.h seems quite common to me as system header name, at least it
> could potentially exist on non-linux for another API, you should
> likely check for the exact function you need.
> And fall back to sysconf for pthread.
That has been taken care of since my code uses:
    && defined(CPU_SETSIZE)
which is only defined if the linux extension is available.
I'll add a comment to clarify.

>
> I'll take care of the beos code.
>
> Just write a stub for OS/2 I suppose.

The stub is already there since it will simply return 1 if
no method was found.

>
> Fran?ois.

Regards, Philipp




More information about the ffmpeg-devel mailing list