[FFmpeg-trac] #10136(swscale:new): Can't convert color range with sws_scale

FFmpeg trac at avcodec.org
Tue Jan 10 13:31:55 EET 2023


#10136: Can't convert color range with sws_scale
------------------------------------+-----------------------------------
             Reporter:  diogo.r     |                    Owner:  (none)
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  swscale
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------
Comment (by diogo.r):

 According with this comment
 (http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=e645a1ddb90a863e129108aad9aa7e2d417f3615)
 the problem is that when setting color range options after initializing
 sws_scale, some fast paths might already be chosen and we can't change it
 anymore.

 I'm wondering if it works when I set everything at the beginning, like so:

 {{{
         SwsContext *sws_ctx = (struct SwsContext*)sws_alloc_context();
         av_opt_set_int(sws_ctx, "srcw", width, 0);
         av_opt_set_int(sws_ctx, "srch", height, 0);
         av_opt_set_int(sws_ctx, "src_format", in_pix_fmt, 0);
         av_opt_set_int(sws_ctx, "dstw", width, 0);
         av_opt_set_int(sws_ctx, "dsth", height, 0);
         av_opt_set_int(sws_ctx, "dst_format", out_pix_fmt, 0);
         av_opt_set_int(sws_ctx, "sws_flags", SWS_BILINEAR, 0);
         av_opt_set_int(sws_ctx, "param0", NULL, 0);
         av_opt_set_int(sws_ctx, "param1", NULL, 0);
         av_opt_set_int(sws_ctx, "src_range", 1, 0);
         // av_opt_set_int(sws_ctx, "dst_range", 1, 0);
         int res = sws_init_context(sws_ctx, NULL, NULL);
 }}}

 It seems to work, is that the proper way to do it? If that's the case, it
 might be helpful to return an error for my first attempt.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10136#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list