[MPlayer-dev-eng] [PATCH] XviD B-Frame CBR and FQ encoding bugfix (fwd)

Martin Drab drab at kepler.fjfi.cvut.cz
Wed Apr 2 13:03:00 CEST 2003


Sorry for sending this again, I forgot the [PATCH] word in the subject.

						Martin Drab

---------- Forwarded message ----------
Date: Wed, 2 Apr 2003 13:00:04 +0200 (CEST)
From: Martin Drab <drab at kepler.fjfi.cvut.cz>
To: mplayer-dev-eng at mplayerhq.hu
Subject: XviD B-Frame CBR and FQ encoding bugfix

Hi,

I'm sending a bugfix for XviD frame encoding. In fact there are two 
bugfixes, both are related to encoding B-Frames.

First fixes the choice between CBR and Fixed Quantizer during setting of 
the parameters for the XviD VBR engine. The condition was totally wrong.

Second fixes the setting of the quantizer parameter for the XviD VBR
engine during CBR frame encoding. It has to be set to 0 (and not -1) in 
order for the XviD VBR engine to fill in the correct calculated value.

The patch can be applied to both CVS and 0.90 release.

						Martin Drab
-------------- next part --------------
diff -Naur Mplayer.orig/libmpcodecs/ve_xvid.c Mplayer.fix/libmpcodecs/ve_xvid.c
--- Mplayer.orig/libmpcodecs/ve_xvid.c	2003-01-19 02:48:52.000000000 +0100
+++ Mplayer.fix/libmpcodecs/ve_xvid.c	2003-03-29 01:35:38.000000000 +0100
@@ -388,14 +388,15 @@
     // get quantizers & I/P decision from the VBR engine
 #ifdef XVID_API_UNSTABLE
     if (xvidenc_max_bframes >= 1) {
-	if (!xvidenc_fixed_quant) {
+	if (xvidenc_fixed_quant > 0) {
 	    // hack, the internal VBR engine isn't fixed-quant aware
 	    fp->enc_frame.quant = xvidenc_fixed_quant;
 	    fp->enc_frame.intra = -1;
 	    fp->enc_frame.bquant = (xvidenc_fixed_quant * xvidenc_bquant_ratio + xvidenc_bquant_offset) / 100;
 	} else
 	    // use the internal VBR engine since the external one isn't bframe aware
-	    fp->enc_frame.quant = fp->enc_frame.intra = fp->enc_frame.bquant = -1;
+	    fp->enc_frame.quant = 0;
+	    fp->enc_frame.intra = fp->enc_frame.bquant = -1;
     } else {
 	fp->enc_frame.quant = vbrGetQuant(&fp->vbr_state);
 	fp->enc_frame.intra = vbrGetIntra(&fp->vbr_state);


More information about the MPlayer-dev-eng mailing list