From 553321d59eca201a337bddffe0a68b3a77bb1592 Mon Sep 17 00:00:00 2001 From: Kirill Gavrilov Date: Fri, 24 Jan 2025 20:28:11 +0300 Subject: [PATCH] libavcodec/hdrdec: accept "#?RGBE" header in addition to "#?RADIANCE" Some Radiance HDR image files in the wild have "#?RGBE" header, which other image readers accept. Also updated hdr_probe() in libavformat/img2dec. --- libavcodec/hdrdec.c | 2 +- libavformat/img2dec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/hdrdec.c b/libavcodec/hdrdec.c index 1a6935ff75..7f3b830b6d 100644 --- a/libavcodec/hdrdec.c +++ b/libavcodec/hdrdec.c @@ -98,7 +98,7 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p, bytestream2_init(&gb, avpkt->data, avpkt->size); hdr_get_line(&gb, line, sizeof(line)); - if (memcmp("#?RADIANCE\n", line, 11)) + if (memcmp("#?RADIANCE\n", line, 11) && memcmp("#?RGBE\n", line, 7)) return AVERROR_INVALIDDATA; do { diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 921458fea9..73ff61fa94 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -1064,7 +1064,7 @@ static int pam_probe(const AVProbeData *p) static int hdr_probe(const AVProbeData *p) { - if (!memcmp(p->buf, "#?RADIANCE\n", 11)) + if (!memcmp(p->buf, "#?RADIANCE\n", 11) || !memcmp(p->buf, "#?RGBE\n", 7)) return AVPROBE_SCORE_MAX; return 0; }