1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-01 22:16:42 +02:00

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>
This commit is contained in:
Christophe Gisquet 2014-08-20 08:10:45 +00:00 committed by Michael Niedermayer
parent 2f0f937577
commit 1506ea947d

View File

@ -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);