[FFmpeg-devel] [RFC] execute2/simplify dnxhdenc threading

Michael Niedermayer michaelni
Mon Oct 12 08:52:29 CEST 2009


On Sat, Oct 10, 2009 at 05:08:35PM +0200, Reimar D?ffinger wrote:
> Hello,
> this is my second try to simplify dnxhdenc and also change the code so
> that number of jobs/tasks > number of threads, avoiding performance
> issues if not all threads finish with the same speed.
> Obviously execute2 must be implemented for the other thread
> implementations, too, and dnxhdenc can probably be further simplified
> (in particular, I doubt that setting start_mb_y and end_mb_y is actually
> necessary), but I wanted to hear if this is on the right track before
> I take it further.
> I haven't tested it too well since I just now realized that all the time
> I had compiled FFmpeg without thread support, if someone volunteers to
> benchmark the speeds of the different implementations they are more than
> welcome.

>  avcodec.h  |   15 ++++++++++++-
[...]
>  options.c  |    1 
>  pthread.c  |   13 ++++++++++-
>  utils.c    |   10 ++++++++
>  6 files changed, 72 insertions(+), 37 deletions(-)
> 1306d5ea93f2e82357f7e328c84a913c2f022ab3  dnxhdthread.diff
[...]
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> @@ -2526,6 +2526,18 @@
>       * - decoding: Set by libavcodec
>       */
>      enum AVChromaLocation chroma_sample_location;
> +
> +    /**
> +     * The codec may call this to execute several independent things.
> +     * It will return only after finishing all tasks.
> +     * The user may replace this with some multithreaded implementation,
> +     * the default implementation will execute the parts serially.
> +     * @param count the number of things to execute
> +     * @param arg2 argument passed unchanged to func
> +     * - encoding: Set by libavcodec, user can override.
> +     * - decoding: Set by libavcodec, user can override.
> +     */
> +    int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);

doxy is missing a few things, like the arguments of func()

except that iam ok with te changes to files i maintain if the new code is
faster which it is for dnxhd according to your tests ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091012/2c61b883/attachment.pgp>



More information about the ffmpeg-devel mailing list