Commit b276263123 for ffmpeg
commit b276263123c9398e96028152ed2acca468e36b82
Author: Lynne <dev@lynne.ee>
Date: Thu Oct 8 13:27:47 2026 +0900
lavf: add Panasonic RW2 image2 support
Panasonic RW2 files decode as a single image through the image2 demuxer,
recognised by the .rw2 extension and an "IIU\0" probe, like TIFF and DNG.
diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index 597314ac04..1bc07fa743 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -947,6 +947,8 @@ following image formats are supported:
@tab V.Flash PTX format
@item QOI @tab X @tab X
@tab Quite OK Image format
+@item RW2 @tab @tab X
+ @tab Panasonic raw image, RawFormat 8 only
@item SGI @tab X @tab X
@tab SGI RGB image format
@item Sun Rasterfile @tab X @tab X
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 24066050a5..302df282cd 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -324,6 +324,7 @@ OBJS-$(CONFIG_IMAGE_PPM_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_PSD_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_QDRAW_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_QOI_PIPE_DEMUXER) += img2dec.o img2.o
+OBJS-$(CONFIG_IMAGE_RW2_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_SGI_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_SVG_PIPE_DEMUXER) += img2dec.o img2.o
OBJS-$(CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER) += img2dec.o img2.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index a79b1e16c0..5795b65561 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -574,6 +574,7 @@ extern const FFInputFormat ff_image_ppm_pipe_demuxer;
extern const FFInputFormat ff_image_psd_pipe_demuxer;
extern const FFInputFormat ff_image_qdraw_pipe_demuxer;
extern const FFInputFormat ff_image_qoi_pipe_demuxer;
+extern const FFInputFormat ff_image_rw2_pipe_demuxer;
extern const FFInputFormat ff_image_sgi_pipe_demuxer;
extern const FFInputFormat ff_image_svg_pipe_demuxer;
extern const FFInputFormat ff_image_sunrast_pipe_demuxer;
diff --git a/libavformat/img2.c b/libavformat/img2.c
index 2c69a932da..36d669f24c 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -57,6 +57,7 @@
TAG(TIFF, tiff ) \
TAG(TIFF, tif ) \
TAG(TIFF, dng ) \
+ TAG(RW2, rw2 ) \
TAG(SGI, sgi ) \
TAG(PTX, ptx ) \
TAG(PHOTOCD, pcd ) \
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index d5718eff41..e51b3437bd 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -982,6 +982,13 @@ static int tiff_probe(const AVProbeData *p)
return 0;
}
+static int rw2_probe(const AVProbeData *p)
+{
+ if (AV_RB32(p->buf) == 0x49495500 && AV_RL32(p->buf + 4) >= 8)
+ return AVPROBE_SCORE_MAX;
+ return 0;
+}
+
static int webp_probe(const AVProbeData *p)
{
const uint8_t *b = p->buf;
@@ -1241,6 +1248,7 @@ IMAGEAUTO_DEMUXER(ppm, PPM)
IMAGEAUTO_DEMUXER(psd, PSD)
IMAGEAUTO_DEMUXER(qdraw, QDRAW)
IMAGEAUTO_DEMUXER(qoi, QOI)
+IMAGEAUTO_DEMUXER(rw2, RW2)
IMAGEAUTO_DEMUXER(sgi, SGI)
IMAGEAUTO_DEMUXER(sunrast, SUNRAST)
IMAGEAUTO_DEMUXER(svg, SVG)