Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 922543
Collapse All | Expand All

(-)a/libavcodec/libjxldec.c (+16 lines)
Lines 198-211 Link Here
198
    JxlDecoderStatus jret;
198
    JxlDecoderStatus jret;
199
    /* an ICC profile is present, and we can meaningfully get it,
199
    /* an ICC profile is present, and we can meaningfully get it,
200
     * because the pixel data is not XYB-encoded */
200
     * because the pixel data is not XYB-encoded */
201
#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
201
    jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
202
    jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
203
#else
204
    jret = JxlDecoderGetICCProfileSize(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
205
#endif
202
    if (jret == JXL_DEC_SUCCESS && icc_len > 0) {
206
    if (jret == JXL_DEC_SUCCESS && icc_len > 0) {
203
        av_buffer_unref(&ctx->iccp);
207
        av_buffer_unref(&ctx->iccp);
204
        ctx->iccp = av_buffer_alloc(icc_len);
208
        ctx->iccp = av_buffer_alloc(icc_len);
205
        if (!ctx->iccp)
209
        if (!ctx->iccp)
206
            return AVERROR(ENOMEM);
210
            return AVERROR(ENOMEM);
211
#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
207
        jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA,
212
        jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA,
208
                                                ctx->iccp->data, icc_len);
213
                                                ctx->iccp->data, icc_len);
214
#else
215
        jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, ctx->iccp->data, icc_len);
216
#endif
209
        if (jret != JXL_DEC_SUCCESS) {
217
        if (jret != JXL_DEC_SUCCESS) {
210
            av_log(avctx, AV_LOG_WARNING, "Unable to obtain ICC Profile\n");
218
            av_log(avctx, AV_LOG_WARNING, "Unable to obtain ICC Profile\n");
211
            av_buffer_unref(&ctx->iccp);
219
            av_buffer_unref(&ctx->iccp);
Lines 241-252 Link Here
241
    /* set this flag if we need to fall back on wide gamut */
249
    /* set this flag if we need to fall back on wide gamut */
242
    int fallback = 0;
250
    int fallback = 0;
243
251
252
#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
244
    jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, NULL, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
253
    jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, NULL, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
254
#else
255
    jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
256
#endif
245
    if (jret == JXL_DEC_SUCCESS) {
257
    if (jret == JXL_DEC_SUCCESS) {
246
        /* enum values describe the colors of this image */
258
        /* enum values describe the colors of this image */
247
        jret = JxlDecoderSetPreferredColorProfile(ctx->decoder, &jxl_color);
259
        jret = JxlDecoderSetPreferredColorProfile(ctx->decoder, &jxl_color);
248
        if (jret == JXL_DEC_SUCCESS)
260
        if (jret == JXL_DEC_SUCCESS)
261
#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
249
            jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
262
            jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
263
#else
264
            jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
265
#endif
250
        /* if we couldn't successfully request the pixel data space, we fall back on wide gamut */
266
        /* if we couldn't successfully request the pixel data space, we fall back on wide gamut */
251
        /* this code path is very unlikely to happen in practice */
267
        /* this code path is very unlikely to happen in practice */
252
        if (jret != JXL_DEC_SUCCESS)
268
        if (jret != JXL_DEC_SUCCESS)

Return to bug 922543