summaryrefslogtreecommitdiff
path: root/libavcodec/pnmenc.c
diff options
context:
space:
mode:
authorChristophe Gisquet <christophe.gisquet@gmail.com>2014-08-20 08:10:45 +0000
committerMichael Niedermayer <michaelni@gmx.at>2014-08-24 11:23:34 +0200
commit1506ea947d3c527f67a5caa93cc7fa0d064bbf1f (patch)
tree02806a1b211bc19c61a2278970e707cb0e6a70a5 /libavcodec/pnmenc.c
parent2f0f937577358a5730a29d7e7662d0f44421a7e4 (diff)
pnmenc: use bits_per_raw_sample
This allows writing actual bitdepth in RGB48 when it isn't actually 16. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pnmenc.c')
-rw-r--r--libavcodec/pnmenc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index e6c3635e7b..9198ddbcad 100644
--- a/libavcodec/pnmenc.c
+++ b/libavcodec/pnmenc.c
@@ -84,6 +84,8 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
bytestream += strlen(bytestream);
if (avctx->pix_fmt != AV_PIX_FMT_MONOWHITE) {
int maxdepth = (1 << (av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth_minus1 + 1)) - 1;
+ if( avctx->bits_per_raw_sample )
+ maxdepth = (1 << avctx->bits_per_raw_sample) - 1;
snprintf(bytestream, bytestream_end - bytestream,
"%d\n", maxdepth);
bytestream += strlen(bytestream);