§ ¶VirtualDub's accelerator keys
VirtualDub has a number of keyboard shortcuts bound to its menu commands. Two of these are F5 (Preview) and F7 (Save as AVI).
Where did these shortcuts come from? No, I don't play darts.
They're the shortcuts for Run (F5) and Build (F7) in Microsoft Visual C++ 6.0. I got so used to those shortcuts during VirtualDub's early development that I naturally used them for my app as well. To the utter confusion of normal users, of course.
(Read more....)§ ¶AMD64 and frustrations of an assembly language programmer
I recently discovered a bug in current versions of VirtualDub that manifests itself as occasionally massive audio sync errors when working with large frame start offsets, at least frame 60000 or so. It is caused by an overflow in the fraction scaling routines, which are used to compute the audio offset since AVI sample rates are 32:32 rational fractions. Whether or not you hit this bug depends on how reduced the fraction is in the AVI file; most files have small numbers here and thus the bug requires a very large frame offset, but it is rarely possible to encounter it in a 1hr+ file if you have a really large or unnormalized fraction. This is being fixed for the future 1.6.6 version by adding 96-bit intermediate arithmetic. What is annoying, however, is that the lack of both sufficient intrinsics and inline assembly support in the AMD64 compiler forces a rather silly assembly language function:
VDFractionScale64 proc public mov rax, rcx mul rdx div r8 mov [r9], edx ret VDFractionScale64 endp
For some reason, the VS2005 compiler for AMD64 has intrinsics to do 128-bit multiply and shift operations, but no add, subtract, or divide operations. Gee, thanks.
On the good side, the AMD64-compatible version of the Platform SDK is out for public download!
http://www.microsoft.com/downloads/details.aspx?FamilyID=d8eecd75-1fc4-49e5-bc66-9da2b03d9b92&DisplayLang=en(Read more....)
§ ¶Compiler intrinsics, revisited
I received an email recently from a member of the Microsoft Visual C++ compiler team who is working on the AMD64 compiler, regarding my comments about intrinsics support in the VC++ compiler. Given my past feedback on this blog and in the MSDN Product Feedback Center on the quality of the intrinsics in VC++, one of two possibilities was possible:
- I had mortally offended the Visual C++ compiler team and had received a notice to appear in Redmond for a formal challenge to the death; or
- They wanted to inform me of significant improvements made to the compiler in the Visual Studio .NET 2005 "Whidbey" public beta.
Fortunately, the team member turned out to be a nice guy and informed me that intrinsics support had indeed been improved in Whidbey.
To review, compiler intrinsics are psuedo-functions that expose CPU functionality that doesn't fit well into C/C++ constructs. Simple operations like add and subtract map nicely to + and -, but four-way-packed-multiply-signed-and-add-pairs doesn't. Instead, the compiler exposes a __m64 type and _m_pmaddwd() psuedo-function that you can use. In theory, you get the power and speed of specialized CPU primitives, with some of the portability benefits of using C/C++ over straight assembly language. The problem in the past was that Visual Studio .NET 2003 and earlier generated poor code for these primitives that was either incorrect or slower than which could be written straight in assembly language with moderate effort.
(Read more....)§ ¶Pitch shifting
I have a lot of miscellaneous junk lying around my hard drive's projwin directory, which is where I keep most of my VC++ projects. A quick glance:
- a fanfiction reader with built-in phrase search across all files and suspend/resume
- a Final Fantasy VII model viewer
- an infinite-playfield version of Conway's Game of Life
- an NTVDM driver to emulate an SBPro in a Windows 2000 dos box
All very unfinished, of course.
One pair of projects that I've hacked on sporadically is an MP3 player with a spectrum analyzer and a WinAmp plugin, which share a simple audio processing library in common. I've experimented with a few audio effects with these; most of them were failures, particularly all of my attempts at reverb. I did have some mild success with some frequency-based algorithms, namely the "center cut" filter that is now in VirtualDub.
A filter that I've been trying to get working well for some time is a pitch shifter. VirtualDub has an experimental one, the "ratty pitch shifter," but as you might guess it's not very good. I recently found an algorithm that works better, though.
(Read more....)§ ¶VirtualDub 1.6.5 released
VirtualDub 1.6.5 is out. I actually had this ready on Friday, but April 1st is not a good day to release software. It's a good thing too since a couple of bugs got fixed between then and today. The 1.6 branch is getting closer to stable and as such most of the changes are bug fixes, although a few new features snuck in there.
One new feature that I hadn't originally planned to add was significantly expanded support for automation; I worked a bit on this after talking with someone who was having difficulty automating video processing in a build pipeline. As a result, 1.6.5 introduces two new executables, vdub.exe and vdub64.exe that are used for command-line operation.
(Read more....)