summaryrefslogtreecommitdiff
path: root/libavcodec/pnm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-03 14:14:55 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-03 15:00:15 +0200
commit62738157dd54475194f9bfadbe80a45e32771931 (patch)
treebc323b840255459ee121fcd09ba8c2ed43ed0806 /libavcodec/pnm.c
parentb7ed18b9bd0f73f1c7aa5533918ea5013dbd593c (diff)
downloadffmpeg-62738157dd54475194f9bfadbe80a45e32771931.tar.gz
pnmdec: always output native pixel format
This simplifies the code Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pnm.c')
-rw-r--r--libavcodec/pnm.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 3fa4d7c95b..63b77cd807 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -118,10 +118,8 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (maxval < 256) {
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
- } else if (maxval < 65535) {
- avctx->pix_fmt = AV_PIX_FMT_GRAY16;
} else {
- avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY16;
}
} else if (depth == 2) {
if (maxval == 255)
@@ -130,13 +128,13 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
if (maxval < 256) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else {
- avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
+ avctx->pix_fmt = AV_PIX_FMT_RGB48;
}
} else if (depth == 4) {
if (maxval < 256) {
avctx->pix_fmt = AV_PIX_FMT_RGBA;
} else {
- avctx->pix_fmt = AV_PIX_FMT_RGBA64BE;
+ avctx->pix_fmt = AV_PIX_FMT_RGBA64;
}
} else {
return AVERROR_INVALIDDATA;
@@ -164,16 +162,14 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
}
if (s->maxval >= 256) {
if (avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
- avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
- if (s->maxval != 65535)
- avctx->pix_fmt = AV_PIX_FMT_GRAY16;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY16;
} else if (avctx->pix_fmt == AV_PIX_FMT_RGB24) {
- avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
+ avctx->pix_fmt = AV_PIX_FMT_RGB48;
} else if (avctx->pix_fmt == AV_PIX_FMT_YUV420P && s->maxval < 65536) {
if (s->maxval < 512)
- avctx->pix_fmt = AV_PIX_FMT_YUV420P9BE;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P9;
else if (s->maxval < 1024)
- avctx->pix_fmt = AV_PIX_FMT_YUV420P10BE;
+ avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
else
avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
} else {