[FFmpeg-devel] [PATCH v14 3/4] avcodec/libjxl: add Jpeg XL encoding via libjxl

Leo Izen leo.izen at gmail.com
Fri Apr 15 22:32:10 EEST 2022


On 4/15/22 06:39, Anton Khirnov wrote:
> Quoting Leo Izen (2022-04-15 03:37:20)
>> On 4/14/22 13:49, Anton Khirnov wrote:
>>> Quoting Leo Izen (2022-04-12 07:53:32)
>>>> +
>>>> +    while (1) {
>>>> +        jret = JxlEncoderProcessOutput(ctx->encoder, &next_out, &available);
>>>> +        if (jret == JXL_ENC_ERROR) {
>>>> +            av_log(avctx, AV_LOG_ERROR, "Unspecified libjxl error occurred\n");
>>>> +            return AVERROR_EXTERNAL;
>>>> +        }
>>>> +        bytes_written = ctx->buffer_size - available;
>>>> +        /* all data passed has been encoded */
>>>> +        if (jret == JXL_ENC_SUCCESS)
>>>> +            break;
>>>> +        if (jret == JXL_ENC_NEED_MORE_OUTPUT) {
>>> Is it possible for the encoder to return anything other than the three
>>> codes you're handling? Won't you get into an infinite loop if it does?
>>>
>> It's just these three, according to the documentation.
>> https://libjxl.readthedocs.io/en/latest/api_encoder.html
> So the end of the loop should be unreachable, as you always break,
> continue or return before. I would put return AVERROR_EXTERNAL there
> just in case.
>
> Beyond that I have no more comments on the set.
>
I suppose a failsafe in case of a bug or futureproofing wouldn't be a 
bad call. I can add one.

- Leo Izen (thebombzen)



More information about the ffmpeg-devel mailing list