Mercurial > libavcodec.hg
diff h263.c @ 766:8d36b35a7e6e libavcodec
slice encoding cleanup
author | michaelni |
---|---|
date | Fri, 25 Oct 2002 00:08:32 +0000 |
parents | 7f4cc2f6d642 |
children | d1770a34e4f6 |
line wrap: on
line diff
--- a/h263.c Thu Oct 24 00:51:17 2002 +0000 +++ b/h263.c Fri Oct 25 00:08:32 2002 +0000 @@ -222,51 +222,25 @@ } } +/** + * Encodes a group of blocks header. + */ int h263_encode_gob_header(MpegEncContext * s, int mb_line) { - int pdif=0; - - /* Check to see if we need to put a new GBSC */ - /* for RTP packetization */ - if (s->rtp_mode) { - pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; - if (pdif >= s->rtp_payload_size) { - /* Bad luck, packet must be cut before */ - align_put_bits(&s->pb); - flush_put_bits(&s->pb); - /* Call the RTP callback to send the last GOB */ - if (s->rtp_callback) { - pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; - s->rtp_callback(s->ptr_lastgob, pdif, s->gob_number); - } - s->ptr_lastgob = pbBufPtr(&s->pb); - put_bits(&s->pb, 17, 1); /* GBSC */ - s->gob_number = mb_line / s->gob_index; - put_bits(&s->pb, 5, s->gob_number); /* GN */ - put_bits(&s->pb, 2, s->pict_type == I_TYPE); /* GFID */ - put_bits(&s->pb, 5, s->qscale); /* GQUANT */ - //fprintf(stderr,"\nGOB: %2d size: %d", s->gob_number - 1, pdif); - return pdif; - } else if (pdif + s->mb_line_avgsize >= s->rtp_payload_size) { - /* Cut the packet before we can't */ align_put_bits(&s->pb); flush_put_bits(&s->pb); /* Call the RTP callback to send the last GOB */ if (s->rtp_callback) { - pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; + int pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; s->rtp_callback(s->ptr_lastgob, pdif, s->gob_number); } - s->ptr_lastgob = pbBufPtr(&s->pb); put_bits(&s->pb, 17, 1); /* GBSC */ s->gob_number = mb_line / s->gob_index; put_bits(&s->pb, 5, s->gob_number); /* GN */ put_bits(&s->pb, 2, s->pict_type == I_TYPE); /* GFID */ put_bits(&s->pb, 5, s->qscale); /* GQUANT */ //fprintf(stderr,"\nGOB: %2d size: %d", s->gob_number - 1, pdif); - return pdif; - } - } - return 0; + return 0; } static inline int decide_ac_pred(MpegEncContext * s, DCTELEM block[6][64], int dir[6])