summaryrefslogtreecommitdiff
path: root/libavcodec/pnm.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2023-10-25 18:46:24 +0200
committerNiklas Haas <git@haasn.dev>2023-11-09 12:53:35 +0100
commit96d2a40b9ee0ddd1844b82c23a074804c316caa5 (patch)
tree95c2619bcafc0384e17065cd5a6876b10c33df71 /libavcodec/pnm.c
parentcf60046cdcdb67fce8cea11c4dbab5bb8f931430 (diff)
avcodec/pnm: explicitly tag color range
PGMYUV seems to be always limited range. This was a format originally invented by FFmpeg at a time when YUVJ distinguished limited from full range YUV, and this codec never appeared to output YUVJ in any circumstance, so hard-coding limited range preserves the status quo. The other formats are explicitly documented to be full range RGB/gray formats. That said, don't tag them yet, due to outstanding bugs w.r.t grayscale formats and color range handling. This change in behavior updates a bunch of FATE tests in trivial ways (added tagging being the only difference).
Diffstat (limited to 'libavcodec/pnm.c')
-rw-r--r--libavcodec/pnm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 77d24eeaf7..9f93c1ae1d 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -97,10 +97,12 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
} else if (s->type==1 || s->type==4) {
avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
} else if (s->type==2 || s->type==5) {
- if (avctx->codec_id == AV_CODEC_ID_PGMYUV)
+ if (avctx->codec_id == AV_CODEC_ID_PGMYUV) {
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- else
+ avctx->color_range = AVCOL_RANGE_MPEG;
+ } else {
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+ }
} else if (s->type==3 || s->type==6) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else if (s->type==7) {