[FFmpeg-devel] [PATCH 2/5] pnmenc: use bits_per_raw_sample

Christophe Gisquet christophe.gisquet at gmail.com
Wed Aug 20 10:10:45 CEST 2014


This allows writing actual bitdepth in RGB48 when it isn't actually 16.
---
 libavcodec/pnmenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index e6c3635..9198ddb 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);
-- 
1.9.2.msysgit.0



More information about the ffmpeg-devel mailing list