How to Compile XviD with Microsoft Visual C++6.0

Xvid 是一个开源(open source)项目,它是目前最流行的Mpeg4解码器之一,下面我介绍一下怎么在VC6环境下编译整个XviD项目.
1.构架编译环境
Xvid 需要很多标准VC6以外的Libaries.
需要:
1) Service Pack5 for Visual Studio 6-
http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/default.asp
这个包以是Visual C++6 最新的补丁包,可以在MSDN里面找到。
2) Visual C++6.0 Processor Pack
http://msdn.microsoft.com/vstudio/downloads/tools/ppack/default.aspx
这个Proceesor pack 增加了支持Intel's SSE,SEE2 and AMD's 3DNow! 指令
3) NASM
 这是一个流行开源汇编编译器 http://sourceforge.net/projects/nasm/
Xvid 是用NASM规范 "compile" code.(.asm files)
4) DirectX 9.0 SDK
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp
Windows DirectShow SDK pack相信大家都知道,Xvid 要通过它来播放xVid视频。
5) Pthreads for Win32(可选)
http://sources.redhat.com/pthreads-win32/
需要用Pthreads library 来编译 SMP vision 的xvid.dll,主要用在双处理器环境上.

II)配置编译环境

1) 安装 Installing Service Pack 6
2) Install Visual C++ Processor Pack
3) Install and Configuring NASM
将NASMW.exe 拷贝到%[vc_install_directory]%/Vc6/bin 下面,并且改名"nasm.exe"
或者在vc6环境中
    i) Click On the "Tools" --->"Options"
    ii) Click On the "Direcotries" tab;
   iii) Select "Executable Files" form the "Show Direcotories For" dropdown box
   iv) Add the path to NASM( 注意,Change the "nasmw.exe" to "nasm.exe")
4) Installing and Configuring the DirectX SDK
    安装"DirectX SDK"包
    To Configure:
     i) Load up Microsoft Visual C++,Click on the "Tools"---->"Options"
     ii) Click on the "Directories "tab
     iii) Select "Include Files" from the "Show Directories For" dropdown box.
     vi) Add the following entry:" <path to DirectX SDK>/SAMPLES/C++/DIRECTSHOW/BASECLASSES" .
 
III) 编译 Xvid
    下载Xvid source code ,打开.dsp文件,最先,我们必须编译 xvidcore
IV)安装 XVID
     Windows 用户,有3个关键文件:
   1)xvid.dll and xvid.inf
     这两个文件在整个项目编译完成后在 "<path to Xvid source code>/vfw/bin/下面会找到.
    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 for Windows compliant program (i.e., almost every video editor out there). In theory, you should 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 wish to 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:

Assembling ../../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/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 the .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 the .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 should 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 of:

"nasm -f win32 -DPREFIX -I"$(InputDir)" -o $(IntDir)/$(InputName).obj $(InputPath)"

Notice the extra "/" between the "(InputDir)" and "-o".

Alternately, you could 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 to:

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 should 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 should work. A quick fix is to open "qpel.c" and replace every instance of

#include __FILE__

with

#include "qpel.c"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值