• Niklas Haas's avatar
    swscale: fix sws_setColorspaceDetails after sws_init_context · cedf589c
    Niklas Haas authored
    More commonly, this fixes the case of sws_setColorspaceDetails after
    sws_getContext, since the latter implies sws_init_context.
    
    The problem here is that sws_init_context sets up the range conversion
    and fast path tables based on the values of srcRange/dstRange at init
    time. This may result in locking in a "wrong" path (either using
    unscaled fast path when range conversion later required, or using
    scaled slow path when range conversion becomes no longer required).
    
    There are two way outs:
    
    1. Always initialize range conversion and unscaled converters, even if
       they will be unused, and extend the runtime check.
    2. Re-do initialization if the values change after
       sws_setColorspaceDetails.
    
    I opted for approach 1 because it was simpler and easier to reason
    about.
    
    Reword the av_log message to make it clear that this special converter
    is not necessarily used, depending on whether or not there is range
    conversion or YUV matrix conversion going on.
    cedf589c
swscale.c 44 KB