[FFmpeg-cvslog] r18497 - in trunk: libavcodec/ac3enc.c libavcodec/bitstream.c libavcodec/gif.c libavcodec/h261enc.c libavcodec/h263.c libavcodec/ljpegenc.c libavcodec/mjpegenc.c libavcodec/mpegaudioenc.c libavcode...
stefano
subversion
Mon Apr 13 18:59:39 CEST 2009
Author: stefano
Date: Mon Apr 13 18:59:38 2009
New Revision: 18497
Log:
Rename pbBufPtr() to put_bits_ptr().
The new name is more readable and consistent with the FFmpeg naming
style.
Modified:
trunk/libavcodec/ac3enc.c
trunk/libavcodec/bitstream.c
trunk/libavcodec/gif.c
trunk/libavcodec/h261enc.c
trunk/libavcodec/h263.c
trunk/libavcodec/ljpegenc.c
trunk/libavcodec/mjpegenc.c
trunk/libavcodec/mpegaudioenc.c
trunk/libavcodec/mpegvideo_enc.c
trunk/libavcodec/put_bits.h
trunk/libavcodec/wmaenc.c
trunk/libavformat/gif.c
trunk/libavformat/mpegenc.c
trunk/libavformat/swfenc.c
Modified: trunk/libavcodec/ac3enc.c
==============================================================================
--- trunk/libavcodec/ac3enc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/ac3enc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -1117,10 +1117,10 @@ static int output_frame_end(AC3EncodeCon
flush_put_bits(&s->pb);
/* add zero bytes to reach the frame size */
frame = s->pb.buf;
- n = 2 * s->frame_size - (pbBufPtr(&s->pb) - frame) - 2;
+ n = 2 * s->frame_size - (put_bits_ptr(&s->pb) - frame) - 2;
assert(n >= 0);
if(n>0)
- memset(pbBufPtr(&s->pb), 0, n);
+ memset(put_bits_ptr(&s->pb), 0, n);
/* Now we must compute both crcs : this is not so easy for crc1
because it is at the beginning of the data... */
Modified: trunk/libavcodec/bitstream.c
==============================================================================
--- trunk/libavcodec/bitstream.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/bitstream.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -91,7 +91,7 @@ void ff_copy_bits(PutBitContext *pb, con
for(i=0; put_bits_count(pb)&31; i++)
put_bits(pb, 8, src[i]);
flush_put_bits(pb);
- memcpy(pbBufPtr(pb), src+i, 2*words-i);
+ memcpy(put_bits_ptr(pb), src+i, 2*words-i);
skip_put_bytes(pb, 2*words-i);
}
Modified: trunk/libavcodec/gif.c
==============================================================================
--- trunk/libavcodec/gif.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/gif.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -126,9 +126,9 @@ static int gif_image_write_image(uint8_t
put_bits(&p, 9, 0x101); /* end of stream */
flush_put_bits(&p);
}
- if(pbBufPtr(&p) - p.buf > 0) {
- bytestream_put_byte(bytestream, pbBufPtr(&p) - p.buf); /* byte count of the packet */
- bytestream_put_buffer(bytestream, p.buf, pbBufPtr(&p) - p.buf); /* the actual buffer */
+ if(put_bits_ptr(&p) - p.buf > 0) {
+ bytestream_put_byte(bytestream, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
+ bytestream_put_buffer(bytestream, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */
}
left-=GIF_CHUNKS;
Modified: trunk/libavcodec/h261enc.c
==============================================================================
--- trunk/libavcodec/h261enc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/h261enc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -55,7 +55,7 @@ void ff_h261_encode_picture_header(MpegE
align_put_bits(&s->pb);
/* Update the pointer to last GOB */
- s->ptr_lastgob = pbBufPtr(&s->pb);
+ s->ptr_lastgob = put_bits_ptr(&s->pb);
put_bits(&s->pb, 20, 0x10); /* PSC */
Modified: trunk/libavcodec/h263.c
==============================================================================
--- trunk/libavcodec/h263.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/h263.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -245,7 +245,7 @@ void h263_encode_picture_header(MpegEncC
align_put_bits(&s->pb);
/* Update the pointer to last GOB */
- s->ptr_lastgob = pbBufPtr(&s->pb);
+ s->ptr_lastgob = put_bits_ptr(&s->pb);
put_bits(&s->pb, 22, 0x20); /* PSC */
temp_ref= s->picture_number * (int64_t)coded_frame_rate * s->avctx->time_base.num / //FIXME use timestamp
(coded_frame_rate_base * (int64_t)s->avctx->time_base.den);
@@ -3053,7 +3053,7 @@ static inline void memsetw(short *tab, i
void ff_mpeg4_init_partitions(MpegEncContext *s)
{
- uint8_t *start= pbBufPtr(&s->pb);
+ uint8_t *start= put_bits_ptr(&s->pb);
uint8_t *end= s->pb.buf_end;
int size= end - start;
int pb_size = (((intptr_t)start + size/3)&(~3)) - (intptr_t)start;
Modified: trunk/libavcodec/ljpegenc.c
==============================================================================
--- trunk/libavcodec/ljpegenc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/ljpegenc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -181,7 +181,7 @@ static int encode_picture_lossless(AVCod
s->picture_number++;
flush_put_bits(&s->pb);
- return pbBufPtr(&s->pb) - s->pb.buf;
+ return put_bits_ptr(&s->pb) - s->pb.buf;
// return (put_bits_count(&f->pb)+7)/8;
}
Modified: trunk/libavcodec/mjpegenc.c
==============================================================================
--- trunk/libavcodec/mjpegenc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/mjpegenc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -135,7 +135,7 @@ static void jpeg_table_header(MpegEncCon
/* huffman table */
put_marker(p, DHT);
flush_put_bits(p);
- ptr = pbBufPtr(p);
+ ptr = put_bits_ptr(p);
put_bits(p, 16, 0); /* patched later */
size = 2;
size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance,
@@ -174,7 +174,7 @@ static void jpeg_put_comments(MpegEncCon
if(!(s->flags & CODEC_FLAG_BITEXACT)){
put_marker(p, COM);
flush_put_bits(p);
- ptr = pbBufPtr(p);
+ ptr = put_bits_ptr(p);
put_bits(p, 16, 0); /* patched later */
ff_put_string(p, LIBAVCODEC_IDENT, 1);
size = strlen(LIBAVCODEC_IDENT)+3;
@@ -186,7 +186,7 @@ static void jpeg_put_comments(MpegEncCon
||s->avctx->pix_fmt == PIX_FMT_YUV444P){
put_marker(p, COM);
flush_put_bits(p);
- ptr = pbBufPtr(p);
+ ptr = put_bits_ptr(p);
put_bits(p, 16, 0); /* patched later */
ff_put_string(p, "CS=ITU601", 1);
size = strlen("CS=ITU601")+3;
Modified: trunk/libavcodec/mpegaudioenc.c
==============================================================================
--- trunk/libavcodec/mpegaudioenc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/mpegaudioenc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -781,7 +781,7 @@ static int MPA_encode_frame(AVCodecConte
encode_frame(s, bit_alloc, padding);
s->nb_samples += MPA_FRAME_SIZE;
- return pbBufPtr(&s->pb) - s->pb.buf;
+ return put_bits_ptr(&s->pb) - s->pb.buf;
}
static av_cold int MPA_encode_close(AVCodecContext *avctx)
Modified: trunk/libavcodec/mpegvideo_enc.c
==============================================================================
--- trunk/libavcodec/mpegvideo_enc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/mpegvideo_enc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -1321,7 +1321,7 @@ vbv_retry:
s->total_bits += s->frame_bits;
avctx->frame_bits = s->frame_bits;
}else{
- assert((pbBufPtr(&s->pb) == s->pb.buf));
+ assert((put_bits_ptr(&s->pb) == s->pb.buf));
s->frame_bits=0;
}
assert((s->frame_bits&7)==0);
@@ -2111,7 +2111,7 @@ static int encode_thread(AVCodecContext
}
assert((put_bits_count(&s->pb)&7) == 0);
- current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob;
+ current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob;
if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){
int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y;
@@ -2121,7 +2121,7 @@ static int encode_thread(AVCodecContext
#ifndef ALT_BITSTREAM_WRITER
s->pb.buf_ptr= s->ptr_lastgob;
#endif
- assert(pbBufPtr(&s->pb) == s->ptr_lastgob);
+ assert(put_bits_ptr(&s->pb) == s->ptr_lastgob);
}
}
@@ -2603,7 +2603,7 @@ static int encode_thread(AVCodecContext
/* Send the last GOB if RTP */
if (s->avctx->rtp_callback) {
int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x;
- pdif = pbBufPtr(&s->pb) - s->ptr_lastgob;
+ pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob;
/* Call the RTP callback to send the last GOB */
emms_c();
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb);
Modified: trunk/libavcodec/put_bits.h
==============================================================================
--- trunk/libavcodec/put_bits.h Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/put_bits.h Mon Apr 13 18:59:38 2009 (r18497)
@@ -263,7 +263,7 @@ static inline void put_sbits(PutBitConte
* Returns the pointer to the byte where the bitstream writer will put
* the next bit.
*/
-static inline uint8_t* pbBufPtr(PutBitContext *s)
+static inline uint8_t* put_bits_ptr(PutBitContext *s)
{
#ifdef ALT_BITSTREAM_WRITER
return s->buf + (s->index>>3);
Modified: trunk/libavcodec/wmaenc.c
==============================================================================
--- trunk/libavcodec/wmaenc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavcodec/wmaenc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -380,7 +380,7 @@ static int encode_superframe(AVCodecCont
put_bits(&s->pb, 8, 'N');
flush_put_bits(&s->pb);
- return pbBufPtr(&s->pb) - s->pb.buf;
+ return put_bits_ptr(&s->pb) - s->pb.buf;
}
AVCodec wmav1_encoder =
Modified: trunk/libavformat/gif.c
==============================================================================
--- trunk/libavformat/gif.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavformat/gif.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -232,9 +232,9 @@ static int gif_image_write_image(ByteIOC
put_bits(&p, 9, 0x101); /* end of stream */
flush_put_bits(&p);
}
- if(pbBufPtr(&p) - p.buf > 0) {
- put_byte(pb, pbBufPtr(&p) - p.buf); /* byte count of the packet */
- put_buffer(pb, p.buf, pbBufPtr(&p) - p.buf); /* the actual buffer */
+ if(put_bits_ptr(&p) - p.buf > 0) {
+ put_byte(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
+ put_buffer(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */
}
left-=GIF_CHUNKS;
Modified: trunk/libavformat/mpegenc.c
==============================================================================
--- trunk/libavformat/mpegenc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavformat/mpegenc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -114,7 +114,7 @@ static int put_pack_header(AVFormatConte
put_bits(&pb, 3, 0); /* stuffing length */
}
flush_put_bits(&pb);
- return pbBufPtr(&pb) - pb.buf;
+ return put_bits_ptr(&pb) - pb.buf;
}
static int put_system_header(AVFormatContext *ctx, uint8_t *buf,int only_for_stream_id)
@@ -256,7 +256,7 @@ static int put_system_header(AVFormatCon
}
flush_put_bits(&pb);
- size = pbBufPtr(&pb) - pb.buf;
+ size = put_bits_ptr(&pb) - pb.buf;
/* patch packet size */
buf[4] = (size - 6) >> 8;
buf[5] = (size - 6) & 0xff;
Modified: trunk/libavformat/swfenc.c
==============================================================================
--- trunk/libavformat/swfenc.c Mon Apr 13 18:47:17 2009 (r18496)
+++ trunk/libavformat/swfenc.c Mon Apr 13 18:59:38 2009 (r18497)
@@ -102,7 +102,7 @@ static void put_swf_rect(ByteIOContext *
put_bits(&p, nbits, ymax & mask);
flush_put_bits(&p);
- put_buffer(pb, buf, pbBufPtr(&p) - p.buf);
+ put_buffer(pb, buf, put_bits_ptr(&p) - p.buf);
}
static void put_swf_line_edge(PutBitContext *pb, int dx, int dy)
@@ -167,7 +167,7 @@ static void put_swf_matrix(ByteIOContext
put_bits(&p, nbits, ty);
flush_put_bits(&p);
- put_buffer(pb, buf, pbBufPtr(&p) - p.buf);
+ put_buffer(pb, buf, put_bits_ptr(&p) - p.buf);
}
static int swf_write_header(AVFormatContext *s)
@@ -293,7 +293,7 @@ static int swf_write_header(AVFormatCont
put_bits(&p, 5, 0);
flush_put_bits(&p);
- put_buffer(pb, buf1, pbBufPtr(&p) - p.buf);
+ put_buffer(pb, buf1, put_bits_ptr(&p) - p.buf);
put_swf_end_tag(s);
}
More information about the ffmpeg-cvslog
mailing list