How to compile Xvid with Microsoft Visual C ++ 6.0
Written by David Carroll
Last Updated: November 23,200 3
OK, you 've got your copy of Microsoft Visual C ++ 6.0. You shocould be able to just
Download the source code, click on the project file, and a few second later, you'll have the Xvid binary. Right? Well, unfortunately, it's not
ThatEasy. However, it's not that hard either.
I. Downloading necessary files
Xvid depends on a number of libraries and programs that do not come standard with Microsoft Visual C ++ 6.0.
You need:
1) Service Pack 5 for Visual Studio 6-
Http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/default.asp
The Service Pack contains all the latest bug fixes for Visual C ++ 6.0 as well as updates to essential libraries. You can download the service pack or order it on CD from
MICROSOftDEvelopersNEtwork (msdn) by clicking the link abve.
2) Visual C ++ 6.0 Processor Pack-
Http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx
The processors pack adds support for Intel's SSE, see2 and AMD's 3 dnow! Instructions.
3) NASM-the famous netwide extends er-
Http://sourceforge.net/projects/nasm/
Xvid uses NASM to "compile" the code written in assembly language (the *. ASM files). Download the Win32 binary.
4) DirectX 9.0 SDK-
Http://msdn.microsoft.com/library/default.asp? Url =/downloads/LIST/DirectX. asp
To build the DirectShow filter, you need the DirectX SDK (SOftwareDEvelopment
KIt). Unfortunately for dial-up users, ~ 200 MB DirectX SDK is no longer available on CD.
5) (optional) pthreads for Win32-
Http://sources.redhat.com/pthreads-win32/
You will need the pthreads library if you want to build the SMP version of The XviD. dll. This is not needed for most users since most users don't have dual processing systems.
Ii. indexing the Compiler
1) installing Service Pack 5
The Service Pack is easy to install since it comes with an installer. The installer's filename is "setupsp5.exe". Just find the file and double-click it.
2) Installing visual c ++ Processor Pack
Double-click "vcpp5.exe" to install.
3) Installing and processing ing NASM
A) unzip the file to an easy to remember directory of your choosing (I. e., "C: \ develop \ NASM ")
B) Xvid expects the filename to be "nasm.exe" (probably because all other versions t the Win32 version has that name ). for some reason, the Win32 version NASM has a filename of "nasmw.exe. "I recommend making a copy of" nasmw.exe "and renaming it" nasm.exe."
C) load up Microsoft Visual C ++.
I) Click on the "Tools" menu and select "options ."
Ii) Click on the "directories" tab.
Iii) Select "executable files" from the "show directories for" dropdown box.
Iv) add the path to NASM (e.g., "C: \ develop \ NASM ")
4) Installing and installing ing the DirectX SDK
The DirectX SDK comes with an installer. Just double-click on the "setup.exe" file and follow the prompts.
To configure the DirectX SDK:
A) load up Microsoft Visual C ++.
B) Click on the "Tools" menu and select "options ."
C) Click on the "directories" tab.
D) Select "include files" from the "show directories for" dropdown box.
E) Add the following entry: "<path to DirectX SDK> \ samples \ c ++ \ DirectShow \ baseclasses" where you replace <path to DirectX SDK> with the actual path to the DirectX SDK (I. E ., "C: \ develop \ dxsdk ").
F) use the little up arrow icon to move the entries to the top of the list.
Iii. Compiling Xvid
Now you can download the source code, click on the workspace file, and a few second later, you'll have the Xvid binary. Just make sure you build the xvidcore first.
Iv. Installing Xvid
For Windows users, there are really only three files you have to be concerned:
1) XviD. dll and XviD. inf-Both of these files are in the "<path to Xvid source code> \ VFW \ bin \" directory. the "XviD. DLL "file is the Xvid video for Windows codec. this file is necessary if you wish to encode any videos using a video
Windows compliant Program (I. E ., almost every video editor out there ). in theory, you shocould be able to play back Xvid files in the Windows Media Player using this file as well although this functionality appears to be broken at this point. therefore, if you
Wish to play back files in a media player, install the "XviD. ax "file (see below ). the "XviD. INF "file is the setup information file. basically, this file tells windows how to install "XviD. DLL ".
To install the Xvid video for Windows codec (aka XviD. dll)
A) simply right-click the "XviD. inf" and select "Install" from the context menu.
That's it, you're done. to verify that the file has been installed correctly, go to the control panel and select "Multimedia ", then click on the "devices" tab and finally see if "Xvid" is listed under the "video compression codecs" section. if you want
Uninstall the Xvid codec, select "Xvid MPEG-4 codec" from the "Add/Remove program" list in the control panel.
2) XviD. Ax-This file is in the "<path to Xvid source code> \ dshow \ bin \" directory. the "XviD. ax "file is the Xvid DirectShow filter. microsoft has decreed that DirectShow shall replace video for windows, so in theory you won't need "XviD. DLL ".
However, this isn't true. Instead, the DirectShow filter is used mostly for playback by newer media players. Most video programs still depend on the video for Windows codec for encoding.
To install the Xvid DirectShow filter (aka XviD. Ax)
A) first copy the "XviD. ax "file to a safe place (I. E ., "C: \ Program Files \ Xvid "). the video for Windows codec is automatically copied to the Windows System directory when you install it. the DirectShow filter is not. therefore, if you delete the source code
Directory, you lose your DirectShow filter.
B) once you have copied the "XviD. ax "file to a safe place, go to the Start menu and select" run. "type" <path to Windows> \ System \ regsvr32 <path to XviD. ax> \ XviD. ax "(I. e, C: \ WINDOWS \ SYSTEM \ regsvr32 c: \ Program Files \ XviD. ax ).
That's it, you're done. there really is no easy way to verify that the DirectShow filter was properly installed other than to play a Xvid encoded video. to uninstall the DirectShow filter, go to the Start menu and select "run. "type" <path to Windows> \ System \ regsvr32
/U <path to XviD. Ax> \ XviD. Ax"
V. troubleshooting FAQ
Q.Why do I get the following error message:
Refreshing ing... \ SRC \ utils \ x86_asm \ mem_transfer_mmx.asm
Bad command or file name
A.You did not correctly install NASM.
Q.What causes this error: "cxviddecoder. OBJ: Error lnk2001: unresolved external symbol _ mediasubtype_iyuv "?
A. This is caused by an outdated strmbase. lib. you need to build a new one. the path to the project file is <path to DirectX SDK> \ samples \ c ++ \ DirectShow \ baseclasses. DSW. after you build the library, I recommend you copy the strmbase. lib
File to <path to DirectX SDK> \ Lib.
Q.I have
Ffdshow, do I need to install the Xvid DirectShow filter?
A. No, not really.
Q.When trying to open a workspace file (. DSW), I get an "empty" workspace (I. e., there are no source files listed) and/or
When trying to open a project file (. DSP), I get a "This makefile was not generated by developer Studio" error.
A. Often, this can be caused by having UNIX line breaks (LF) in. DSW and. DSP files, as opposed to Windows line breaks (Cr \ lf ). it is interesting to note that. DSW and. DSP files are just text files; you can open them up in any text
Editor. if you open. DSW and. DSP files in a text editor that can't handle UNIX line breaks (namely notepad) you will probably see big, black squares at the end of lines. you can "fix" this error by following this procedure.
A) Do not let Microsoft Visual C ++ attempt to fix the problem! Press "no" when prompted.
B) Open the. DSW and. DSP files in a text editor that understands UNIX line breaks. wordpad is one and it is available with most copies of windows.
C) Once open, simply re-save the file (in Wordpad, make sure you set the Save As type to "Text Document "). all UNIX line breaks shocould be converted to Windows line breaks.
Also, I have noticed that some "ARCHIVE" utilities like
WinZip will perform the Unix-> Windows line break conversion automatically so I recommend you use those utilities. At the time of writing, archive utilities that don't perform this conversion include powerarchiver and WinRAR.
Q.I get lots of error messages similar to the following:
... \ .. \ SRC \ quant \ x86_asm \ quantize_mmx.asm: 429: Parser: instruction expected
... \ .. \ SRC \ quant \ x86_asm \ quantize_mmx.asm: 430: Symbol 'movdqa 'redefined
A. You are using an old version of NASM, download a newer version from
Http://sourceforge.net/projects/nasm/
Q.I get a few "Fatal: Unable to open include file 'colorspace _ MMX. inc'" errors.
A. This is apparently caused by versions of NASM newer than 0.98.37. For whatever reason, NASM seems to have trouble dealing with relative paths. To fix the problem:
A) Open up the project settings by pressing ALT-F7 or selecting "Settings" from the "project" menu.
B) Find the following three files under "xvidcore \ image \ image_asm ":
1) colorspace_rgb_mmx.asm
2) colorspace_yuy_mmx.asm
3) colorspace_yuyv_mmx.asm
For each of the files, click on the "Custom Build" tab and change the line in the "commands" box to read:
"NASM-F Win32-dprefix-I" $ (inputdir )"\-O $ (intdir) \ $ (inputname). OBJ $ (inputpath )"
Instead:
"NASM-F Win32-dprefix-I" $ (inputdir) "-o $ (intdir) \ $ (inputname). OBJ $ (inputpath )"
Notice the extra "\" between the "(inputdir)" and "-o ".
Alternately, you coshould just downgrade back to NASM
0.98.36.
Q. What does "error c2520: conversion from unsigned _ int64 to double not implemented, use signed _ int64" mean?
A.It means you need to install the Visual C ++ Processor Pack.
Q. I have visual C ++ 6.0 standard. Microsoft says I need the professional or Enterprise Edition in order to install the Processor Pack. Does this mean I am out of luck?
A.No. But it does mean you can't use the installer. Instead, you have to manually install the Processor Pack. Bascially, You have:
A) extract the files to a temporary directory using your favorite archive utilitly (I. e., WinZip ).
B) Find the "vcpp. inf" file in the temporary directory and open it. Inside that file is all the information you need to install the Processor Pack manually.
Hint: An entry like:
[Copytomsdev98bin]
Enablesimd. Reg, enabl _ 1.reg, 32
Means you shoshould rename "enable _ 1.reg" to" enablesimd. Reg "and copy it to the <path to Visual C ++> \ msdev98 \ bin directory.
C) using the information in "vcpp. inf", copy the files from the temporary directory to the proper directories, renaming if necessary.
Q. What causes this error: "C: \ Xvid \ SRC \ image \ qpel. C (84): Fatal error c1083: cannot open include file: 'C :\\ Xvid \ SRC \ image \ qpel. c': no such file or directory."
A.Not exactly sure why that happens-It shocould work. A quick fix is to open "qpel. c" and replace every instance
# Include _ file __
With
# Include "qpel. c"