[Libav-user] multithreaded use of sws_scale

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] multithreaded use of sws_scale

Martin Belleau
I see that sws_scale has srcSliceY and srcSliceH, which should allow to
perform scaling of different slices in parallel.

Is there any sample code which demonstrates how to use it?

Should the same SwsContext be used to scale all the slices?

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: multithreaded use of sws_scale

J Decker
I would think you would want different SwsContexts for each thread.  Otherwise you'd set the parameters for the first thread, and then the second thread would override those parameters used in the structure.



On Mon, Sep 18, 2017 at 10:19 AM, Martin Belleau <[hidden email]> wrote:
I see that sws_scale has srcSliceY and srcSliceH, which should allow to perform scaling of different slices in parallel.

Is there any sample code which demonstrates how to use it?

Should the same SwsContext be used to scale all the slices?

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: multithreaded use of sws_scale

Martin Belleau

I was able to get sliced scaling to work, using a different SwsContext for each slice.

The problem is I can only use two slices, otherwise I run into the 'Slices start in the middle!' error.  The line of code that detects that error is:

if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH)

I'm not sure about sliceDir (I think it's about handling of upside-down slices?) but basically either srcSliceY has to be 0 (meaning your slice starts from the very top of the source), or srcSliceY plus srcSliceH has to be c->srcH (meaning your slice ends at the very top of the source).

Is that 2 slice limit a known and expected limitation?


On 9/18/2017 8:09 PM, J Decker wrote:
I would think you would want different SwsContexts for each thread.  Otherwise you'd set the parameters for the first thread, and then the second thread would override those parameters used in the structure.



On Mon, Sep 18, 2017 at 10:19 AM, Martin Belleau <[hidden email]> wrote:
I see that sws_scale has srcSliceY and srcSliceH, which should allow to perform scaling of different slices in parallel.

Is there any sample code which demonstrates how to use it?

Should the same SwsContext be used to scale all the slices?

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: multithreaded use of sws_scale

Martin Belleau

I also noticed that vf_scale.c has an option to use multiple slices, but I don't have code yet to exercise ffmpeg video filters, and I don't know how to configure it to use slices using ffmpeg.exe command line.


On 9/19/2017 3:30 PM, Martin Belleau wrote:

I was able to get sliced scaling to work, using a different SwsContext for each slice.

The problem is I can only use two slices, otherwise I run into the 'Slices start in the middle!' error.  The line of code that detects that error is:

if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH)

I'm not sure about sliceDir (I think it's about handling of upside-down slices?) but basically either srcSliceY has to be 0 (meaning your slice starts from the very top of the source), or srcSliceY plus srcSliceH has to be c->srcH (meaning your slice ends at the very top of the source).

Is that 2 slice limit a known and expected limitation?


On 9/18/2017 8:09 PM, J Decker wrote:
I would think you would want different SwsContexts for each thread.  Otherwise you'd set the parameters for the first thread, and then the second thread would override those parameters used in the structure.



On Mon, Sep 18, 2017 at 10:19 AM, Martin Belleau <[hidden email]> wrote:
I see that sws_scale has srcSliceY and srcSliceH, which should allow to perform scaling of different slices in parallel.

Is there any sample code which demonstrates how to use it?

Should the same SwsContext be used to scale all the slices?

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user