[Libav-user] multithreaded use of sws_scale

Martin Belleau mbelleau at capellasystems.net
Wed Sep 20 01:30:04 EEST 2017

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 
> <mbelleau at capellasystems.net <mailto:mbelleau at capellasystems.net>> 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
>     Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org>
>     http://ffmpeg.org/mailman/listinfo/libav-user
>     <http://ffmpeg.org/mailman/listinfo/libav-user>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170919/34b40bd3/attachment.html>

More information about the Libav-user mailing list