[FFmpeg-devel] [PATCH] avcodec/put_bits: Add PUTBIT_FLAG_ONLY_LENGTH

Michael Niedermayer michaelni at gmx.at
Sun May 24 17:49:16 CEST 2015


This allows skipping computationally expensive writing code in the first pass of 2
pass encoding.
Its equivalent to AVCodecContexts CODEC_FLAG2_NO_OUTPUT but by putting it in
PutBitContext it becomes available without the need to keep a pointer to
AVCodecContext or some other context around

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/put_bits.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 52eb7fb..a9795ce 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -32,11 +32,14 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avassert.h"
 
+#define PUTBIT_FLAG_ONLY_LENGTH   1       ///< The output will not be used except for its length
+
 typedef struct PutBitContext {
     uint32_t bit_buf;
     int bit_left;
     uint8_t *buf, *buf_ptr, *buf_end;
     int size_in_bits;
+    int flags;
 } PutBitContext;
 
 /**
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list