diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-02-12 15:43:16 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-02-12 15:43:16 +0000 |
commit | 17592475b3ee4c45ab43ac38e46fe8063b314811 (patch) | |
tree | d23901a813ee1777b9c4451870e111a9940c9fc9 /libavcodec/mpegvideo.c | |
parent | 9bd8bd1add6be33f5eb7f2645350901ab2a56a6c (diff) | |
download | ffmpeg-17592475b3ee4c45ab43ac38e46fe8063b314811.tar.gz |
alternative bitstream writer (disabled by default, uncomment #define ALT_BISTREAM_WRITER in common.h if u want to try it)
Originally committed as revision 295 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index f38ee13a65..261a84795c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -532,9 +532,10 @@ int MPV_encode_picture(AVCodecContext *avctx, mjpeg_picture_trailer(s); flush_put_bits(&s->pb); - s->total_bits += (s->pb.buf_ptr - s->pb.buf) * 8; + s->total_bits += (pbBufPtr(&s->pb) - s->pb.buf) * 8; + avctx->quality = s->qscale; - return s->pb.buf_ptr - s->pb.buf; + return pbBufPtr(&s->pb) - s->pb.buf; } static inline int clip(int a, int amin, int amax) @@ -1115,13 +1116,15 @@ static void encode_picture(MpegEncContext *s, int picture_number) MPV_decode_mb(s, s->block); } + + /* Obtain average GOB size for RTP */ if (s->rtp_mode) { if (!mb_y) - s->mb_line_avgsize = s->pb.buf_ptr - s->ptr_last_mb_line; + s->mb_line_avgsize = pbBufPtr(&s->pb) - s->ptr_last_mb_line; else if (!(mb_y % s->gob_index)) { - s->mb_line_avgsize = (s->mb_line_avgsize + s->pb.buf_ptr - s->ptr_last_mb_line) >> 1; - s->ptr_last_mb_line = s->pb.buf_ptr; + s->mb_line_avgsize = (s->mb_line_avgsize + pbBufPtr(&s->pb) - s->ptr_last_mb_line) >> 1; + s->ptr_last_mb_line = pbBufPtr(&s->pb); } //fprintf(stderr, "\nMB line: %d\tSize: %u\tAvg. Size: %u", s->mb_y, // (s->pb.buf_ptr - s->ptr_last_mb_line), s->mb_line_avgsize); @@ -1138,11 +1141,11 @@ static void encode_picture(MpegEncContext *s, int picture_number) /* Send the last GOB if RTP */ if (s->rtp_mode) { flush_put_bits(&s->pb); - pdif = s->pb.buf_ptr - s->ptr_lastgob; + pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; /* Call the RTP callback to send the last GOB */ if (s->rtp_callback) s->rtp_callback(s->ptr_lastgob, pdif, s->gob_number); - s->ptr_lastgob = s->pb.buf_ptr; + s->ptr_lastgob = pbBufPtr(&s->pb); //fprintf(stderr,"\nGOB: %2d size: %d (last)", s->gob_number, pdif); } |