[MPlayer-cvslog] CVS: main/libmpcodecs ve_lavc.c, 1.131, 1.132 ve_x264.c, 1.45, 1.46 ve_xvid4.c, 1.23, 1.24 ve_xvid.c, 1.31, 1.32

Corey Hickey CVS syncmail at mplayerhq.hu
Tue Feb 21 10:39:24 CET 2006


CVS change done by Corey Hickey CVS

Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv29957/libmpcodecs

Modified Files:
	ve_lavc.c ve_x264.c ve_xvid4.c ve_xvid.c 
Log Message:
Fix video delay when encoding with B-frames.

Encoding delay is adjusted for on-the-fly during encoding.

Decoding delay is compensated for by setting an appropriate dwStart on
the audio stream (only in muxer_avi at this point). 



Index: ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -r1.131 -r1.132
--- ve_lavc.c	31 Jan 2006 23:36:12 -0000	1.131
+++ ve_lavc.c	21 Feb 2006 09:39:21 -0000	1.132
@@ -770,6 +770,8 @@
         mux_v->bih->biSize= sizeof(BITMAPINFOHEADER) + lavc_venc_context->extradata_size;
     }
     
+    mux_v->decoder_delay = lavc_venc_context->max_b_frames ? 1 : 0;
+    
     return 1;
 }
 
@@ -854,8 +856,10 @@
 	out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size,
 	    pic);
 
-    if(out_size == 0)
+    if(out_size == 0) {
+        ++mux_v->encoder_delay;
         return 0;
+    }
            
     muxer_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
         

Index: ve_x264.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_x264.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- ve_x264.c	31 Jan 2006 23:36:12 -0000	1.45
+++ ve_x264.c	21 Feb 2006 09:39:21 -0000	1.46
@@ -435,6 +435,11 @@
         return 0;
     }
     
+    if (mod->param.i_bframe > 1 && mod->param.b_bframe_pyramid)
+        mod->mux->decoder_delay = 2;
+    else
+        mod->mux->decoder_delay = mod->param.i_bframe ? 1 : 0;
+    
     return 1;
 }
 
@@ -511,6 +516,8 @@
                         && frame_ref == 1 && !bframe);
         muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
     }
+    else
+        ++mod->mux->encoder_delay;
 
     return i_size;
 }

Index: ve_xvid4.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_xvid4.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ve_xvid4.c	26 Jan 2006 19:32:06 -0000	1.23
+++ ve_xvid4.c	21 Feb 2006 09:39:21 -0000	1.24
@@ -504,6 +504,8 @@
 	/* Store the encoder instance into the private data */
 	mod->instance = mod->create.handle;
 
+	mod->mux->decoder_delay = mod->create.max_bframes ? 1 : 0;
+
 	return(FINE);
 }
 
@@ -620,7 +622,10 @@
 	}
 
 	/* If size is == 0, we're done with that frame */
-	if(size == 0) return(FINE);
+	if(size == 0) {
+		++mod->mux->encoder_delay;
+		return(FINE);
+	}
 
 	/* xvidcore returns stats about encoded frame in an asynchronous way
 	 * accumulate these stats */

Index: ve_xvid.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_xvid.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- ve_xvid.c	26 Jan 2006 19:32:06 -0000	1.31
+++ ve_xvid.c	21 Feb 2006 09:39:21 -0000	1.32
@@ -378,6 +378,10 @@
 
     vbrInit(&fp->vbr_state);
 
+#ifdef XVID_API_UNSTABLE
+    fp->mux->decoder_delay = enc_param.max_bframes ? 1 : 0;
+#endif
+
     return 1;
 }
 
@@ -523,7 +527,10 @@
 #endif
     
     // write output
+    if (fp->enc_frame.length > 0)
     muxer_write_chunk(fp->mux, fp->enc_frame.length, fp->enc_frame.intra==1 ? 0x10 : 0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
+    else
+		++fp->mux->encoder_delay;
 
     // update the VBR engine
     vbrUpdate(&fp->vbr_state, enc_stats.quant, fp->enc_frame.intra,




More information about the MPlayer-cvslog mailing list