1 Apr 2022, 02:20 by leo.i...@gmail.com: > This commit adds support to libavcodec to read and parse > encoded Jpeg XL images. Jpeg XL is intended to be an > extended-life replacement to legacy mjpeg. > --- > MAINTAINERS | 2 + > libavcodec/Makefile | 1 + > libavcodec/codec_desc.c | 9 + > libavcodec/codec_id.h | 1 + > libavcodec/jpegxl.h | 43 ++ > libavcodec/jpegxl_parser.c | 951 +++++++++++++++++++++++++++++++++++++ > + } > + } > + if (header->color_space == FF_JPEGXL_CS_GRAY) { > + if (header->bits_per_sample <= 8) > + return alpha ? AV_PIX_FMT_YA8 : AV_PIX_FMT_GRAY8; > + if (header->bits_per_sample > 16 || header->exp_bits_per_sample) > + return alpha ? AV_PIX_FMT_NONE : AV_PIX_FMT_GRAYF32; > + return alpha ? AV_PIX_FMT_YA16 : AV_PIX_FMT_GRAY16; > + } else if (header->color_space == FF_JPEGXL_CS_RGB > + || header->color_space == FF_JPEGXL_CS_XYB) { > + if (header->bits_per_sample <= 8) > + return alpha ? AV_PIX_FMT_RGBA : AV_PIX_FMT_RGB24; > + if (header->bits_per_sample > 16 || header->exp_bits_per_sample) > + return alpha ? AV_PIX_FMT_GBRAPF32 : AV_PIX_FMT_GBRPF32; > + return alpha ? AV_PIX_FMT_RGBA64 : AV_PIX_FMT_RGB48; > + } > + return AV_PIX_FMT_NONE; >
YUV is supported, via the do_YCbCr flag in the spec. I think we ought to set the pixel format to YUV444P/16 in that case, as the codec requires YUV to be upsampled during decoding, and doing unnecessary colorspace conversions inside decoders is something we don't want. Decoders are free to change what the parser sets, so if users link to libjxl, then RGB will be reported as lavf will decode the first frame during probing. Otherwise, the native decoder would match what the parser reports and output YUV444-frames when signalled. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".