summaryrefslogtreecommitdiff
path: root/libavcodec/pnm.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-07-01 10:06:15 +0200
committerPaul B Mahol <onemda@gmail.com>2022-07-03 15:16:31 +0200
commitff1450e449f848ad4b37b3cf448315ba4581364e (patch)
tree4c6e245afa51c3ec58bb0865ed27f2940acf4f4a /libavcodec/pnm.c
parent33fe3b73c2d4dec674509de5dc48698895f0806b (diff)
downloadffmpeg-ff1450e449f848ad4b37b3cf448315ba4581364e.tar.gz
avcodec: add PHM decoder and encoder
Diffstat (limited to 'libavcodec/pnm.c')
-rw-r--r--libavcodec/pnm.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 958f2a342e..605a529622 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -73,18 +73,27 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
(s->bytestream[1] < '1' ||
s->bytestream[1] > '7' &&
s->bytestream[1] != 'f' &&
- s->bytestream[1] != 'F')) {
+ s->bytestream[1] != 'F' &&
+ s->bytestream[1] != 'H' &&
+ s->bytestream[1] != 'h')) {
s->bytestream += s->bytestream_end > s->bytestream;
s->bytestream += s->bytestream_end > s->bytestream;
return AVERROR_INVALIDDATA;
}
pnm_get(s, buf1, sizeof(buf1));
s->type= buf1[1]-'0';
+ s->half = 0;
if (buf1[1] == 'F') {
avctx->pix_fmt = AV_PIX_FMT_GBRPF32;
} else if (buf1[1] == 'f') {
avctx->pix_fmt = AV_PIX_FMT_GRAYF32;
+ } else if (buf1[1] == 'H') {
+ avctx->pix_fmt = AV_PIX_FMT_GBRPF32;
+ s->half = 1;
+ } else if (buf1[1] == 'h') {
+ avctx->pix_fmt = AV_PIX_FMT_GRAYF32;
+ s->half = 1;
} else if (s->type==1 || s->type==4) {
avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
} else if (s->type==2 || s->type==5) {