[MPlayer-dev-eng] XviD codec

Chris Bednar cjb at AdvancedDataSolutions.com
Sun Jan 13 06:48:00 CET 2002


> > > > vop_start_code' messages.
> > > 
> > >     I got sig11 on divx4-encoded avis until I commented out
> > > 3 BSWAP's in core/src/decoder/bitreader.h. Then, I get no 
> > > image and `no vop_start_code' messages.
> > :)

    OK, if you're ready for something strange, I tried commenting
out the #ifndef's instead, and the whole thing works. That is,
I changed core/src/decoder/bitreader.h to look like

//#ifndef BIG_ENDIAN
	BSWAP(tmp);
//#endif

and it worked. I have no idea why it doesn't work without the comments,
since I looked at what came out of the preprocessor, and the BSWAP's 
were there. It looks like somehow, one of the objects is getting compiled
without them, and the other with, but I still don't understand how.

    Anyway, this is not really a nice way to do it; I finally changed to

#ifdef LITTLE_ENDIAN
	BSWAP(tmp);
#endif

and do a -DLITTLE_ENDIAN in Makefile.linux. With -O2, etc, it plays back
about as well as divx4linux. Looks to me like XviD may be more workable
than I thought.


    The encoding works, too, although with a few glitches. I think that's
supposed to be fixed, so I'll try updating and see what I get.


    I'll include my patch at end, with the variable-name changes, too..
I guess I need to see if I can get it in to videocoding.


---- ``Windows: It does that sometimes.''  -mattdm
Chris J. Bednar
Director, Distributed Computing Product Group
http://AdvancedDataSolutions.com/


   ---The Whole Thing---------------------

diff -u -P --recursive opendivx.0/core/build/generic/Makefile.linux opendivx/core/build/generic/Makefile.linux
--- opendivx.0/core/build/generic/Makefile.linux	Mon Dec 31 07:25:05 2001
+++ opendivx/core/build/generic/Makefile.linux	Sat Jan 12 23:21:05 2002
@@ -15,8 +15,8 @@
 include Makefile.inc
 
 
-CC = gcc
-CFLAGS = -Wall -DARCH_X86 -DLINUX -g 
+CC = gcc3
+CFLAGS = -Wall -DARCH_X86 -DLINUX -DLITTLE_ENDIAN=1 -O2 -march=i686
 
 LIBDIR = /usr/local/lib
 
diff -u -P --recursive opendivx.0/core/src/common/common.c opendivx/core/src/common/common.c
--- opendivx.0/core/src/common/common.c	Fri Jan 11 21:42:17 2002
+++ opendivx/core/src/common/common.c	Fri Jan 11 21:49:33 2002
@@ -53,10 +53,10 @@
 
 	idct_int32_init();
 
-	fdct = fdct_int32;
-	idct = idct_int32;
+	odivx_fdct = fdct_int32;
+	odivx_idct = idct_int32;
 
-	emms = emms_c;
+	odivx_emms = emms_c;
 
 	quant_intra = quant_intra_c;
 	dequant_intra = dequant_intra_c;
@@ -81,10 +81,10 @@
 
 #ifdef ARCH_X86
 	if((cpu_flags & XVID_CPU_MMX) > 0) {
-		fdct = fdct_mmx;
-		idct = idct_mmx;
+		odivx_fdct = fdct_mmx;
+		odivx_idct = idct_mmx;
 
-		emms = emms_mmx;
+		odivx_emms = emms_mmx;
 
 		quant_intra = quant_intra_mmx;
 		dequant_intra = dequant_intra_mmx;
@@ -103,7 +103,7 @@
 	}
 
 	if((cpu_flags & XVID_CPU_MMXEXT) > 0) {
-		idct = idct_xmm;
+		odivx_idct = idct_xmm;
 	}
 
 	if((cpu_flags & XVID_CPU_3DNOW) > 0) {
@@ -115,7 +115,7 @@
 }
 
 
-emmsFuncPtr emms;
+emmsFuncPtr odivx_emms;
 void emms_c() {}
 void emms_mmx() { EMMS(); }
 
diff -u -P --recursive opendivx.0/core/src/common/common.h opendivx/core/src/common/common.h
--- opendivx.0/core/src/common/common.h	Fri Jan 11 21:42:17 2002
+++ opendivx/core/src/common/common.h	Fri Jan 11 21:49:39 2002
@@ -104,7 +104,7 @@
 typedef void (emmsFunc)();
 typedef emmsFunc* emmsFuncPtr;	
 
-extern emmsFuncPtr emms;
+extern emmsFuncPtr odivx_emms;
 
 emmsFunc emms_c;
 emmsFunc emms_mmx;
@@ -115,7 +115,7 @@
 typedef void (fdctFunc)(short * const block);
 typedef fdctFunc* fdctFuncPtr;	
 
-extern fdctFuncPtr fdct;
+extern fdctFuncPtr odivx_fdct;
 
 fdctFunc fdct_int32;
 fdctFunc fdct_mmx;
@@ -128,7 +128,7 @@
 typedef void (idctFunc)(short * const block);
 typedef idctFunc* idctFuncPtr;	
 
-extern idctFuncPtr idct;
+extern idctFuncPtr odivx_idct;
 
 idctFunc idct_int32;
 idctFunc idct_mmx;
diff -u -P --recursive opendivx.0/core/src/common/fdct.c opendivx/core/src/common/fdct.c
--- opendivx.0/core/src/common/fdct.c	Fri Jan 11 21:42:17 2002
+++ opendivx/core/src/common/fdct.c	Fri Jan 11 21:31:04 2002
@@ -109,7 +109,7 @@
 #define FIX_3_072711026  ((int) 25172)	/* FIX(3.072711026) */
 
 // function pointer
-fdctFuncPtr fdct;
+fdctFuncPtr odivx_fdct;
 
 /*
  * Perform an integer forward DCT on one block of samples.
diff -u -P --recursive opendivx.0/core/src/common/idct.c opendivx/core/src/common/idct.c
--- opendivx.0/core/src/common/idct.c	Fri Jan 11 21:42:17 2002
+++ opendivx/core/src/common/idct.c	Fri Jan 11 21:24:38 2002
@@ -204,7 +204,7 @@
 }*/
 
 // function pointer
-idctFuncPtr idct;
+idctFuncPtr odivx_idct;
 
 /* two dimensional inverse discrete cosine transform */
 //void j_rev_dct(block)
diff -u -P --recursive opendivx.0/core/src/decoder/bitreader.c opendivx/core/src/decoder/bitreader.c
--- opendivx.0/core/src/decoder/bitreader.c	Thu Jan  3 13:42:56 2002
+++ opendivx/core/src/decoder/bitreader.c	Sat Jan 12 23:37:57 2002
@@ -174,7 +174,7 @@
 			if (bs_show(bs, 8) != VIDOBJLAY_TYPE_SIMPLE &&	// video_object_type_indication
 				bs_show(bs, 8) != 0)		// BUGGY DIVX
 			{
-				DEBUG("video_object_type_indication != simple");
+				DEBUG ("video_object_type_indication != simple");
 				return -1;
 			}
 			bs_skip(bs, 8);
@@ -502,6 +502,7 @@
 					{
 						bs_skip(bs, 1);		// top_field_first
 						bs_skip(bs, 1);		// alternative_vertical_scan_flag
+					}
 				*/
 			}
 						
diff -u -P --recursive opendivx.0/core/src/decoder/bitreader.h opendivx/core/src/decoder/bitreader.h
--- opendivx.0/core/src/decoder/bitreader.h	Thu Jan  3 13:42:56 2002
+++ opendivx/core/src/decoder/bitreader.h	Sat Jan 12 23:18:34 2002
@@ -37,13 +37,13 @@
 	bs->start = (uint32_t*)bitstream;
 
 	tmp = *(uint32_t *)bitstream;
-#ifndef BIG_ENDIAN
+#ifdef LITTLE_ENDIAN
 	BSWAP(tmp);
 #endif
 	bs->bufa = tmp;
 
 	tmp = *((uint32_t *)bitstream + 1);
-#ifndef BIG_ENDIAN
+#ifdef LITTLE_ENDIAN
 	BSWAP(tmp);
 #endif
 	bs->bufb = tmp;
@@ -89,7 +89,7 @@
 
 		bs->bufa = bs->bufb;
 		tmp = *(uint32_t *)bs->tail;
-#ifndef BIG_ENDIAN
+#ifdef LITTLE_ENDIAN
 		BSWAP(tmp);
 #endif
 		bs->bufb = tmp;
diff -u -P --recursive opendivx.0/core/src/decoder/decoder.c opendivx/core/src/decoder/decoder.c
--- opendivx.0/core/src/decoder/decoder.c	Fri Jan 11 21:42:17 2002
+++ opendivx/core/src/decoder/decoder.c	Sat Jan 12 18:04:32 2002
@@ -187,7 +187,7 @@
 		stop_iquant_timer();
 
 		start_timer();
-		idct(data);
+		odivx_idct(data);
 		stop_idct_timer();
 
 		start_timer();
@@ -279,7 +279,7 @@
 			stop_iquant_timer();
 
 			start_timer();
-			idct(data);
+			odivx_idct(data);
 			stop_idct_timer();
 
 			start_timer();
@@ -528,7 +528,7 @@
 	uint32_t fcode;
 
 	start_global_timer();
-	
+
 	bs_init(&bs, frame->bitstream, frame->length);
 
 	switch (bs_headers(&bs, dec, &rounding, &quant, &fcode))
@@ -558,7 +558,7 @@
 				frame->image, frame->stride, frame->colorspace);
 	stop_conv_timer();
 	
-	emms();
+	odivx_emms();
 
 	stop_global_timer();
 
diff -u -P --recursive opendivx.0/core/src/decore.h opendivx/core/src/decore.h
--- opendivx.0/core/src/decore.h	Sun Dec 16 09:05:03 2001
+++ opendivx/core/src/decore.h	Sat Jan 12 23:01:35 2002
@@ -47,7 +47,7 @@
 #endif
 
 #if ( (! defined (WIN32)) && (! defined (LINUX)) )
-#define BIG_ENDIAN
+//#define BIG_ENDIAN
 #endif
 
 /**
diff -u -P --recursive opendivx.0/core/src/encoder/encoder.c opendivx/core/src/encoder/encoder.c
--- opendivx.0/core/src/encoder/encoder.c	Fri Jan 11 21:31:07 2002
+++ opendivx/core/src/encoder/encoder.c	Fri Jan 11 21:49:48 2002
@@ -603,7 +603,7 @@
 			stop_coding_timer();
 		}
 
-	emms();
+	odivx_emms();
 
     *pBits = BsPos(bs) - *pBits;
     pEnc->sStat.fMvPrevSigma = -1;
@@ -739,7 +739,7 @@
 		}
 	}
 
-	emms();
+	odivx_emms();
 
 	if (pEnc->sStat.iMvCount == 0)
 		pEnc->sStat.iMvCount = 1;
diff -u -P --recursive opendivx.0/core/src/encoder/mbtransquant.c opendivx/core/src/encoder/mbtransquant.c
--- opendivx.0/core/src/encoder/mbtransquant.c	Fri Jan 11 21:42:18 2002
+++ opendivx/core/src/encoder/mbtransquant.c	Fri Jan 11 21:31:15 2002
@@ -107,7 +107,7 @@
 		stop_transfer_timer();
 
 		start_timer();
-		fdct(data[i]);
+		odivx_fdct(data[i]);
 		stop_dct_timer();
 
 		if (pParam->quant_type == 0)
@@ -132,7 +132,7 @@
 		}
 
 		start_timer();
-		idct(data[i]);
+		odivx_idct(data[i]);
 		stop_idct_timer();
 
 		start_timer();
@@ -186,7 +186,7 @@
 		(this is performed already in motion compensation) 
 		*/
 		start_timer();
-		fdct(data[i]);
+		odivx_fdct(data[i]);
 		stop_dct_timer();
 
 		if (pParam->quant_type == 0)
@@ -220,7 +220,7 @@
 			cbp |= 1 << (5 - i);
 
 			start_timer();
-			idct(data[i]);
+			odivx_idct(data[i]);
 			stop_idct_timer();
 
 			start_timer();
@@ -249,4 +249,4 @@
 		}
 	}
     return cbp;
-}
\ No newline at end of file
+}
diff -u -P --recursive opendivx.0/core/src/xvid.c opendivx/core/src/xvid.c
--- opendivx.0/core/src/xvid.c	Wed Dec 26 09:39:49 2001
+++ opendivx/core/src/xvid.c	Sat Jan 12 23:39:59 2002
@@ -67,7 +67,7 @@
 	init_common(cpu_flags);
 	init_decoder(cpu_flags);
 	init_encoder(cpu_flags);
-	
+
 	// API version: 1.0
 	init_param->api_version = API_VERSION;
 
Only in opendivx.0: list




More information about the MPlayer-dev-eng mailing list