[FFmpeg-devel] [PATCH v1 1/2] lavc/vp9: set yuvj pixel format for full range decode

Leo Izen leo.izen at gmail.com
Sat Jun 17 17:48:42 EEST 2023

On 6/17/23 10:26, Thilo Borgmann wrote:
> Am 17.06.23 um 16:02 schrieb Leo Izen:
>> On 6/17/23 04:11, Thilo Borgmann wrote:
>>> While the yuvj pixel formats are deprecated lots of code still relies
>>> on them to be set. Without setting a yuvj420p pixel format VP9
>>> decoding ends up incorrectly due to auto conversion.
>> I oppose this on principle. If there's code that relies on YUVJ being 
>> set, then *that code* needs to be changed so it respects the 
>> AVFrame->color_range field. Which code is working improperly with this?
> I don't like adding YUVJ stuff either. If I do
>   ./ffmpeg -i full-range-in.mp4 -c:v libvpx-vp9 -lossless 1 
> lossless-out.mp4

In this case, it looks like the libvpx-vp9 wrapper is not respecting the 
AVFrame->color_range tag, or the vp9 decoder is not setting it. In 
either case, I don't mind the patch that allows the vp9 encoder to 
handle YUVJ formats correctly if they are passed, but it needs to also 
respect the color_range tag if it's set to AVCOL_RANGE_JPEG.

The ffvp9 decoder should, in my opinion, produce yuv420p frames with the 
flag set, and then the libvpx-vp9 encoder wrapper should respect the 
flag, and treat yuv420p with RANGE_JPEG as though it were passed 
yuvj420p, and do the same thing.

In theory, if both of these are implemented, then the command above 
should work. However, I admit I'm not sure how much work it is relative 
to the patch you just sent. When I find some time I could take a look at 
it as well.

- Leo Izen

More information about the ffmpeg-devel mailing list