Commit 5acaa5e1 authored by Michael Niedermayer's avatar Michael Niedermayer

simplify slice encoding (variance of packet size is practically identical)

Originally committed as revision 1719 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 3c300082
......@@ -3043,7 +3043,6 @@ static void encode_picture(MpegEncContext *s, int picture_number)
s->resync_mb_y=0;
s->first_slice_line = 1;
s->ptr_lastgob = s->pb.buf;
s->ptr_last_mb_line = s->pb.buf;
for(mb_y=0; mb_y < s->mb_height; mb_y++) {
s->y_dc_scale= s->y_dc_scale_table[ s->qscale ];
s->c_dc_scale= s->c_dc_scale_table[ s->qscale ];
......@@ -3078,7 +3077,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
is_gob_start=0;
if(s->codec_id==CODEC_ID_MPEG4){
if(current_packet_size + s->mb_line_avgsize/s->mb_width >= s->rtp_payload_size
if(current_packet_size >= s->rtp_payload_size
&& s->mb_y + s->mb_x>0){
if(s->partitioned_frame){
......@@ -3096,7 +3095,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
is_gob_start=1;
}
}else{
if(current_packet_size + s->mb_line_avgsize*s->gob_index >= s->rtp_payload_size
if(current_packet_size >= s->rtp_payload_size
&& s->mb_x==0 && s->mb_y>0 && s->mb_y%s->gob_index==0){
h263_encode_gob_header(s, mb_y);
......@@ -3411,17 +3410,6 @@ static void encode_picture(MpegEncContext *s, int picture_number)
}
//printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_width, get_bit_count(&s->pb));
}
/* Obtain average mb_row size for RTP */
if (s->rtp_mode) {
if (mb_y==0)
s->mb_line_avgsize = pbBufPtr(&s->pb) - s->ptr_last_mb_line;
else {
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);
}
}
emms_c();
......
......@@ -578,8 +578,6 @@ typedef struct MpegEncContext {
int rtp_payload_size;
void (*rtp_callback)(void *data, int size, int packet_number);
uint8_t *ptr_lastgob;
uint8_t *ptr_last_mb_line;
uint32_t mb_line_avgsize;
DCTELEM (*block)[64]; ///< points to one of the following blocks
DCTELEM blocks[2][6][64] __align8; // for HQ mode we need to keep the best block
......
......@@ -11,7 +11,7 @@ a0bec32a81f9a4cd174557a49cd26430 *./data/a-wmv1.avi
7261e23fd8ad1de6efee022051b936be *./data/out.yuv
82822fc90059bc16a3ec159019b38b18 *./data/a-h263.avi
545df74e0aa443499600faedd10a7065 *./data/out.yuv
c92f9396cce0978caf6b5e7074a5812d *./data/a-h263p.avi
ea780b40dc689a2060303a7b4e99a768 *./data/a-h263p.avi
668ba3cb87859ca4d9a4269bad47b3f5 *./data/out.yuv
d625bba8e06bed36d201657cf9503bd0 *./data/a-odivx.avi
98bb113f0fa0d61fd3b0b1699ac6c69a *./data/out.yuv
......@@ -19,7 +19,7 @@ d625bba8e06bed36d201657cf9503bd0 *./data/a-odivx.avi
799d3db687f6cdd7a837ec156efc171f *./data/out.yuv
9e1358a14c690c50ac98f3fd8ec4b75f *./data/a-mpeg4-rc.avi
580000bfe2d4359d9aa9a9415f953b3b *./data/out.yuv
6ef12f847b9a2a53c06ab05d69f0d255 *./data/a-mpeg4-adv.avi
b7d2c2cb5064b966b057643a80e5454b *./data/a-mpeg4-adv.avi
4c5e8754506ff2c53649541e4fcd2438 *./data/out.yuv
3c65a1bc6866649e666286c825bd5b96 *./data/a-mpeg1b.mpg
da8e21c7b78b7a25558dc319524b91d8 *./data/out.yuv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment