Opened 5 years ago

Closed 5 years ago

#3963 closed enhancement (invalid)

Should sws_getCachedContext have parameters for srcRange and dstRange? Does handle_jpeg return the correct range values?

Reported by: mantler Owned by:
Priority: normal Component: swscale
Version: unspecified Keywords:
Cc: mantler, Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


sws_getCachedContext calls sws_init_context, which calls handle_jpeg and prints out the warning "deprecated pixel format used, make sure you did set range correctly" if either the srcFormat or dstFormat are one of the YUVJ pixel formats. However, not using a YUVJ format means that the appropriate change to the range doesn't happen if we use the corresponding YUV format but want the range for YUVJ. Adding srcRange and dstRange as parameters to sws_getCachedContext would allow us to avoid the deprecation warning message.

On a related note, in handle_jpeg, are the returned range values for the YUVJ formats correct? Currently it's returning 1 (which is AVCOL_RANGE_MPEG), I'm wondering if it should be AVCOL_RANGE_JPEG?

Change History (5)

comment:1 Changed 5 years ago by gjdfgh

  • Cc added

In my opinion, no. There are too many parameters, and we'd end up extending this function all the time.

Actually I had a patch that changes the swscale API to: sws_scale(sws_context *ctx, AVFrame *out, AVFrame *in), and the ctx would be automatically reconfigured to the AVFrame parameters. Maybe I should revive it.

comment:2 Changed 5 years ago by mantler

Thank you for the response. Do you happen to know about the correct range values for YUVJ?

comment:3 Changed 5 years ago by gjdfgh

The YUVJ pixel formats are a big hack (and unfortunately still output by the decoders), but I think these formats should automatically switch libswscale to jpeg range.

In the swscale.h header I see: 1=jpeg / 0=mpeg

comment:4 Changed 5 years ago by mantler

Going by what I'm finding while googling, it seems that the YUVJ stuff is a mess. :(

Ah, yes, I see that 1=jpeg / 0=mpeg now... I mistakenly thought that the field was using the AVColorRange enumeration.

Thank you for the assistance!

comment:5 Changed 5 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed

Please reopen if there is a bug or missing feature that can be reproduced.

Note: See TracTickets for help on using tickets.