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.
This commit is contained in:
Kirill Gavrilov
2026-05-13 19:35:33 +00:00
committed by Marton Balint
co-authored by Marton Balint
parent f69aa0cc64
commit 553321d59e
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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 {
+1 -1
View File
@@ -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;
}