libavcodec/wmv2enc.c:48: error: Null Dereference
  pointer `&pb->buf_ptr` last assigned on line 35 could be null and is dereferenced by call to `flush_put_bits()` at line 48, column 5.

libavcodec/wmv2enc.c:30:1: start of procedure encode_ext_header()
28. 
29. 
30. static int encode_ext_header(Wmv2Context *w){
    ^
31.     MpegEncContext * const s= &w->s;
32.     PutBitContext pb;

libavcodec/wmv2enc.c:31:5: 
29. 
30. static int encode_ext_header(Wmv2Context *w){
31.     MpegEncContext * const s= &w->s;
        ^
32.     PutBitContext pb;
33.     int code;

libavcodec/wmv2enc.c:35:5: 
33.     int code;
34. 
35.     init_put_bits(&pb, s->avctx->extradata, s->avctx->extradata_size);
        ^
36. 
37.     put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29

libavcodec/put_bits.h:53:1: start of procedure init_put_bits()
  51.  * @param buffer_size the size in bytes of buffer
  52.  */
  53. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer,
      ^
  54.                                  int buffer_size)
  55. {

libavcodec/put_bits.h:56:9: Taking true branch
  54.                                  int buffer_size)
  55. {
  56.     if (buffer_size < 0) {
              ^
  57.         buffer_size = 0;
  58.         buffer      = NULL;

libavcodec/put_bits.h:57:9: 
  55. {
  56.     if (buffer_size < 0) {
  57.         buffer_size = 0;
              ^
  58.         buffer      = NULL;
  59.     }

libavcodec/put_bits.h:58:9: 
  56.     if (buffer_size < 0) {
  57.         buffer_size = 0;
  58.         buffer      = NULL;
              ^
  59.     }
  60. 

libavcodec/put_bits.h:61:5: 
  59.     }
  60. 
  61.     s->size_in_bits = 8 * buffer_size;
          ^
  62.     s->buf          = buffer;
  63.     s->buf_end      = s->buf + buffer_size;

libavcodec/put_bits.h:62:5: 
  60. 
  61.     s->size_in_bits = 8 * buffer_size;
  62.     s->buf          = buffer;
          ^
  63.     s->buf_end      = s->buf + buffer_size;
  64.     s->buf_ptr      = s->buf;

libavcodec/put_bits.h:63:5: 
  61.     s->size_in_bits = 8 * buffer_size;
  62.     s->buf          = buffer;
  63.     s->buf_end      = s->buf + buffer_size;
          ^
  64.     s->buf_ptr      = s->buf;
  65.     s->bit_left     = 32;

libavcodec/put_bits.h:64:5: 
  62.     s->buf          = buffer;
  63.     s->buf_end      = s->buf + buffer_size;
  64.     s->buf_ptr      = s->buf;
          ^
  65.     s->bit_left     = 32;
  66.     s->bit_buf      = 0;

libavcodec/put_bits.h:65:5: 
  63.     s->buf_end      = s->buf + buffer_size;
  64.     s->buf_ptr      = s->buf;
  65.     s->bit_left     = 32;
          ^
  66.     s->bit_buf      = 0;
  67. }

libavcodec/put_bits.h:66:5: 
  64.     s->buf_ptr      = s->buf;
  65.     s->bit_left     = 32;
  66.     s->bit_buf      = 0;
          ^
  67. }
  68. 

libavcodec/put_bits.h:67:1: return from a call to init_put_bits
  65.     s->bit_left     = 32;
  66.     s->bit_buf      = 0;
  67. }
      ^
  68. 
  69. /**

libavcodec/wmv2enc.c:37:5: 
35.     init_put_bits(&pb, s->avctx->extradata, s->avctx->extradata_size);
36. 
37.     put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29
        ^
38.     put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047));
39. 

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:38:23: Condition is true
36. 
37.     put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29
38.     put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047));
                          ^
39. 
40.     put_bits(&pb, 1, w->mspel_bit=1);

libavcodec/wmv2enc.c:38:5: 
36. 
37.     put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29
38.     put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047));
        ^
39. 
40.     put_bits(&pb, 1, w->mspel_bit=1);

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:40:5: 
38.     put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047));
39. 
40.     put_bits(&pb, 1, w->mspel_bit=1);
        ^
41.     put_bits(&pb, 1, s->loop_filter);
42.     put_bits(&pb, 1, w->abt_flag=1);

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:41:5: 
39. 
40.     put_bits(&pb, 1, w->mspel_bit=1);
41.     put_bits(&pb, 1, s->loop_filter);
        ^
42.     put_bits(&pb, 1, w->abt_flag=1);
43.     put_bits(&pb, 1, w->j_type_bit=1);

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:42:5: 
40.     put_bits(&pb, 1, w->mspel_bit=1);
41.     put_bits(&pb, 1, s->loop_filter);
42.     put_bits(&pb, 1, w->abt_flag=1);
        ^
43.     put_bits(&pb, 1, w->j_type_bit=1);
44.     put_bits(&pb, 1, w->top_left_mv_flag=0);

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:43:5: 
41.     put_bits(&pb, 1, s->loop_filter);
42.     put_bits(&pb, 1, w->abt_flag=1);
43.     put_bits(&pb, 1, w->j_type_bit=1);
        ^
44.     put_bits(&pb, 1, w->top_left_mv_flag=0);
45.     put_bits(&pb, 1, w->per_mb_rl_bit=1);

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:44:5: 
42.     put_bits(&pb, 1, w->abt_flag=1);
43.     put_bits(&pb, 1, w->j_type_bit=1);
44.     put_bits(&pb, 1, w->top_left_mv_flag=0);
        ^
45.     put_bits(&pb, 1, w->per_mb_rl_bit=1);
46.     put_bits(&pb, 3, code=1);

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:45:5: 
43.     put_bits(&pb, 1, w->j_type_bit=1);
44.     put_bits(&pb, 1, w->top_left_mv_flag=0);
45.     put_bits(&pb, 1, w->per_mb_rl_bit=1);
        ^
46.     put_bits(&pb, 3, code=1);
47. 

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:46:5: 
44.     put_bits(&pb, 1, w->top_left_mv_flag=0);
45.     put_bits(&pb, 1, w->per_mb_rl_bit=1);
46.     put_bits(&pb, 3, code=1);
        ^
47. 
48.     flush_put_bits(&pb);

libavcodec/put_bits.h:131:1: start of procedure put_bits()
  129.  * Use put_bits32 to write 32 bits.
  130.  */
  131. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  132. {
  133.     unsigned int bit_buf;

libavcodec/put_bits.h:136:5: 
  134.     int bit_left;
  135. 
  136.     assert(n <= 31 && value < (1U << n));
           ^
  137. 
  138.     bit_buf  = s->bit_buf;

libavcodec/put_bits.h:138:5: 
  136.     assert(n <= 31 && value < (1U << n));
  137. 
  138.     bit_buf  = s->bit_buf;
           ^
  139.     bit_left = s->bit_left;
  140. 

libavcodec/put_bits.h:139:5: 
  137. 
  138.     bit_buf  = s->bit_buf;
  139.     bit_left = s->bit_left;
           ^
  140. 
  141.     /* XXX: optimize */

libavcodec/put_bits.h:152:9: Taking true branch
  150.     bit_left -= n;
  151. #else
  152.     if (n < bit_left) {
               ^
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;

libavcodec/put_bits.h:153:9: 
  151. #else
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
               ^
  154.         bit_left   -= n;
  155.     } else {

libavcodec/put_bits.h:154:9: 
  152.     if (n < bit_left) {
  153.         bit_buf     = (bit_buf << n) | value;
  154.         bit_left   -= n;
               ^
  155.     } else {
  156.         bit_buf   <<= bit_left;

libavcodec/put_bits.h:165:5: 
  163. #endif
  164. 
  165.     s->bit_buf  = bit_buf;
           ^
  166.     s->bit_left = bit_left;
  167. }

libavcodec/put_bits.h:166:5: 
  164. 
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
           ^
  167. }
  168. 

libavcodec/put_bits.h:167:1: return from a call to put_bits
  165.     s->bit_buf  = bit_buf;
  166.     s->bit_left = bit_left;
  167. }
       ^
  168. 
  169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

libavcodec/wmv2enc.c:48:5: 
46.     put_bits(&pb, 3, code=1);
47. 
48.     flush_put_bits(&pb);
        ^
49. 
50.     s->slice_height = s->mb_height / code;

libavcodec/put_bits.h:80:1: start of procedure flush_put_bits()
  78.  * Pad the end of the output stream with zeros.
  79.  */
  80. static inline void flush_put_bits(PutBitContext *s)
      ^
  81. {
  82. #ifndef BITSTREAM_WRITER_LE

libavcodec/put_bits.h:83:9: Taking true branch
  81. {
  82. #ifndef BITSTREAM_WRITER_LE
  83.     if (s->bit_left < 32)
              ^
  84.         s->bit_buf <<= s->bit_left;
  85. #endif

libavcodec/put_bits.h:84:9: 
  82. #ifndef BITSTREAM_WRITER_LE
  83.     if (s->bit_left < 32)
  84.         s->bit_buf <<= s->bit_left;
              ^
  85. #endif
  86.     while (s->bit_left < 32) {

libavcodec/put_bits.h:86:12: Loop condition is true. Entering loop body
  84.         s->bit_buf <<= s->bit_left;
  85. #endif
  86.     while (s->bit_left < 32) {
                 ^
  87.         /* XXX: should test end of buffer */
  88. #ifdef BITSTREAM_WRITER_LE

libavcodec/put_bits.h:92:9: 
  90.         s->bit_buf  >>= 8;
  91. #else
  92.         *s->buf_ptr++ = s->bit_buf >> 24;
              ^
  93.         s->bit_buf  <<= 8;
  94. #endif

static int encode_ext_header(Wmv2Context *w){
    MpegEncContext * const s= &w->s;
    PutBitContext pb;
    int code;
    init_put_bits(&pb, s->avctx->extradata, s->avctx->extradata_size);
    put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num);
    put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047));
    put_bits(&pb, 1, w->mspel_bit=1);
    put_bits(&pb, 1, s->loop_filter);
    put_bits(&pb, 1, w->abt_flag=1);
    put_bits(&pb, 1, w->j_type_bit=1);
    put_bits(&pb, 1, w->top_left_mv_flag=0);
    put_bits(&pb, 1, w->per_mb_rl_bit=1);
    put_bits(&pb, 3, code=1);
    flush_put_bits(&pb);
    s->slice_height = s->mb_height / code;
    return 0;
}
['static int encode_ext_header(Wmv2Context *w){\n    MpegEncContext * const s= &w->s;\n    PutBitContext pb;\n    int code;\n    init_put_bits(&pb, s->avctx->extradata, s->avctx->extradata_size);\n    put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num);\n    put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047));\n    put_bits(&pb, 1, w->mspel_bit=1);\n    put_bits(&pb, 1, s->loop_filter);\n    put_bits(&pb, 1, w->abt_flag=1);\n    put_bits(&pb, 1, w->j_type_bit=1);\n    put_bits(&pb, 1, w->top_left_mv_flag=0);\n    put_bits(&pb, 1, w->per_mb_rl_bit=1);\n    put_bits(&pb, 3, code=1);\n    flush_put_bits(&pb);\n    s->slice_height = s->mb_height / code;\n    return 0;\n}', 'static inline void init_put_bits(PutBitContext *s, uint8_t *buffer,\n                                 int buffer_size)\n{\n    if (buffer_size < 0) {\n        buffer_size = 0;\n        buffer      = NULL;\n    }\n    s->size_in_bits = 8 * buffer_size;\n    s->buf          = buffer;\n    s->buf_end      = s->buf + buffer_size;\n    s->buf_ptr      = s->buf;\n    s->bit_left     = 32;\n    s->bit_buf      = 0;\n}', 'static inline void put_bits(PutBitContext *s, int n, unsigned int value)\n{\n    unsigned int bit_buf;\n    int bit_left;\n    assert(n <= 31 && value < (1U << n));\n    bit_buf  = s->bit_buf;\n    bit_left = s->bit_left;\n#ifdef BITSTREAM_WRITER_LE\n    bit_buf |= value << (32 - bit_left);\n    if (n >= bit_left) {\n        AV_WL32(s->buf_ptr, bit_buf);\n        s->buf_ptr += 4;\n        bit_buf     = (bit_left == 32) ? 0 : value >> bit_left;\n        bit_left   += 32;\n    }\n    bit_left -= n;\n#else\n    if (n < bit_left) {\n        bit_buf     = (bit_buf << n) | value;\n        bit_left   -= n;\n    } else {\n        bit_buf   <<= bit_left;\n        bit_buf    |= value >> (n - bit_left);\n        AV_WB32(s->buf_ptr, bit_buf);\n        s->buf_ptr += 4;\n        bit_left   += 32 - n;\n        bit_buf     = value;\n    }\n#endif\n    s->bit_buf  = bit_buf;\n    s->bit_left = bit_left;\n}', 'static inline void flush_put_bits(PutBitContext *s)\n{\n#ifndef BITSTREAM_WRITER_LE\n    if (s->bit_left < 32)\n        s->bit_buf <<= s->bit_left;\n#endif\n    while (s->bit_left < 32) {\n#ifdef BITSTREAM_WRITER_LE\n        *s->buf_ptr++ = s->bit_buf;\n        s->bit_buf  >>= 8;\n#else\n        *s->buf_ptr++ = s->bit_buf >> 24;\n        s->bit_buf  <<= 8;\n#endif\n        s->bit_left  += 8;\n    }\n    s->bit_left = 32;\n    s->bit_buf  = 0;\n}']