Commit 1506ea94 authored by Christophe Gisquet's avatar Christophe Gisquet Committed by Michael Niedermayer

pnmenc: use bits_per_raw_sample

This allows writing actual bitdepth in RGB48 when it isn't actually 16.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 2f0f9375
...@@ -84,6 +84,8 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -84,6 +84,8 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
bytestream += strlen(bytestream); bytestream += strlen(bytestream);
if (avctx->pix_fmt != AV_PIX_FMT_MONOWHITE) { 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; 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, snprintf(bytestream, bytestream_end - bytestream,
"%d\n", maxdepth); "%d\n", maxdepth);
bytestream += strlen(bytestream); bytestream += strlen(bytestream);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment