Tag Archives: GMA 500

Building the Intel EMGD display driver for Sony VAIO P with fully working backlight control

Background

The Windows 7 driver for the GMA 500 GPU has not been updated for nearly two years now (v2030 from September 2010). According to this document Intel will only support and continue to maintain the EMGD driver going forward. This is a driver for Linux and Windows primarily for embedded systems, but unfortunately its target audience is system manufacturers and not end users (it’s distributed as a driver build kit). You need quite a detailed technical understanding of the hardware you’re creating the driver for, in particular the LCD panel specifications. Sony are unlikely to provide new driver builds for a three year old laptop, and it will most likely be needed for Windows 8 compatibility. I seem to remember reading that the Windows 8 Release Preview will not accept the GMA 500 Windows 7 driver. The EMGD driver does also have one big advantage in that it includes an OpenGL ICD, which the Windows 7 GMA 500 driver has always lacked.

Thanks in part to ‘viewtiful’ on the Pocketables forum having shared the DTD details for the 1600×768 panel, several people (myself included) had built prior versions of EMGD for the VAIO P, but no one was able to get the LCD backlight working correctly. The onscreen control provided by Sony Shared Library has 8 different levels, and it would turn off the backlight completely at levels 1-3. Experimenting with building new drivers is an extremely slow and painstaking process, especially when you’re not very clear on which values may need tweaking, but I’m pleased to say that I finally got all 8 brightness levels working this evening. And rather than keeping that knowledge secret, I’m sharing it here so that other Vaio users can build their own EMGD drivers for future release versions.

Download

Here is my pre-built driver:
Intel_EMGD_1.16_VaioP_Windows7_v3228_patters.zip

Method

Download and install Intel EMGD (version 1.16 from November 2012 is the latest at the time of writing). Launch the emgd-ced shortcut it has created on your desktop. This will start the java builder application.

Firstly create a new DTD called 1600×768@60Hz with settings as shown. Don’t worry about the greyed out values at the bottom of the screenshot – they’re not used.

New-dtd-for-vaio-p

Next create a new configuration called 16x7Sony like so:

EMGD-vaio-p-config1

Define the LVDS port name as MID (the name the regular GMA 500 driver uses), select the options as shown, taking care to select the custom DTD you just created:

EMGD-vaio-p-config2

In that same screen, click the Attributes button and set the Inverter Frequency to 300. Many thanks to Kirk over at the Intel Embedded Communities Forum for helping me to home in on this being the crucial setting. There are several mentions in the EMGD documentation of a reference value of 20300 which turns out to be incorrect for the VAIO P’s screen. I spent hours searching high and low in vain for a datasheet for this LCD panel (a Toshiba LT080EE04000). Eventually I discovered on the Notebook Review forum that a user called jeonghun had created an EMGD 1.10 build crucially with all eight backlight levels working for the VAIO X laptop which also has a GMA 500, though with a different 1366×768 panel. Since at this point I knew what to look for I opened his driver inf and discovered the magic value of 300. I took a guess that the motherboard-to-LCD circuitry would probably be similar for both models of VAIO.

EMGD-vaio-p-config3-attributes

Click Finish to close that window, and now click on Flat Panel Settings. The VAIO P panel is an 18bit panel. I can’t remember exactly, but I think all these values are the defaults:

EMGD-vaio-p-config4-panel-settings

Now that we’re finished with the LVDS settings (the built-in screen), click Next to move on to configuring the sDVO external monitor connection. Name it Monitor to keep it consistent with the Windows 7 GMA 500 driver. We don’t need any customization other than what is shown in this screenshot:

EMGD-vaio-p-config5-sDVO

The final screen after this relates to building a video BIOS which we aren’t interested in so leave these settings on the defaults. Once finished, create a new package called SonyVaioP:

EMGD-vaio-p-package

Finally while selecting the package, click on Generate Installation in the toolbar. This will create your zipped driver which can be found in:
C:\IEMGD\IEMGD_1_16\workspace\installation\SonyVaioP.pkg_installation\IEMGD_HEAD_Windows7

5.1 channel audio through ordinary headphones using MPC-HC

Blown-Away Man

Though I have owned a surround sound system before, I don’t currently have the space for one. I was recently considering buying gaming headphones with support for Dolby Digital 5.1 channel audio which I could also use for watching films. With some more reading I discovered that these hardware solutions will only work with a Dolby Digital source (AC-3). The problem is that I have a lot of content with DTS audio which the chips in these products don’t support, not to mention MP4 files with multichannel AAC audio.

Reading the specs of these headphones, I discovered that they license a technology called Dolby Headphone – some clever signal processing developed by Lake DSP in Sydney. Early 5.1 channel headphones actually contained multiple tweeters mounted at different positions inside each ‘can’ which apparently weren’t very convincing, but this better approach is more of an emulation – one that relies on the fact that you only have two ears. It’s able to model the audio delays and reflections of a room containing a 5.1 setup, plus it seems to boost up the low frequencies so you’re really aware of the LFE channel. I don’t really understand why there isn’t much awareness of Dolby Headphone. It’s not at all new – look at this 1998 press release!

What’s also not very widely known is that Dolby Headphone can be encoded in software, through the likes of PowerDVD’s audio decoder, regardless of whether your sound chip is Dolby Headphone certified (as some now are). It’s also not particularly processor intensive – my Sony Vaio P can play H.264 movies and process DH with its Intel GMA 500 GPU and meagre 1.33GHz Intel Atom Z520 CPU.

 

What does Dolby Headphone sound like?

Listen for yourself – plug in some headphones and try these DH encoded samples. The choice of movie trailer isn’t exactly showcasing the 360 degree soundstage, but it was quite tricky to encode so I didn’t want the hassle of sampling a scene from an actual film. I can assure you that the action sequences in District 9 for instance sound a whole lot better with Dolby Headphone enabled.


These samples are 192Kbps MP3 files for size reasons. The slight metallic high-end ringing to the deep bass is an encoder artifact from the conversion to MP3 using the LAME encoder, and it was still present when I tried 320Kbps. The channel test clip was taken from http://www.lynnemusic.com/surround.html and the I Am Legend trailer was from http://www.h264info.com/clips.html.

 

How to get it working for AC-3, AAC, and DTS multichannel sources

In a previous post I explained how to setup Media Player Classic Home Cinema to use a third party h.264 decoder with DXVA support. MPC-HC has several key advantages as a media player – it’s open source, it’s lean, it’s extremely configurable, and it plays pretty much any format. I use it for my Sony Vaio P to keep CPU use as low as possible on its rather limited Intel Atom processor. Many people use MPC-HC for their Home Theatre PCs, hence this article.

A guide for configuring Dolby Headphone using PowerDVD’s CyberLink Audio Decoder already exists (with files):
http://www.head-fi.org/forum/thread/405417/guide-dolby-headphone-in-mpc-zoom-player

However that information isn’t sufficient. The complication is that when this decoder is used outside the PowerDVD software, it only works with DTS audio streams even though it should also support AC-3. Reading around, it seems that the AC-3 support works in Windows XP but not in Vista nor in Windows 7.

The next piece of the puzzle can be found here on the forum for Zoom Player, a commercial media player:
http://forum.inmatrix.com/index.php?showtopic=7224

The important point is that the CyberLink decoder can accept a multichannel LPCM input, so you can use another decoder (ffdshow tryouts in this case) to convert the source bitstream into LPCM first, then feed that to the CyberLink decoder. This means that multichannel AAC audio found in MP4 containers could have Dolby Headphone applied too. The above post describes how to do this for Zoom Player, but we’re interested in MPC-HC. The next obstacle is figuring out how to link multiple decoders together in MPC-HC – something I couldn’t find any info about despite spending hours searching online.

The key to understanding this is knowing how the modular Windows DirectShow media layer works. If you’ve already played with MPC-HC you will be familiar with adding and removing filters, as well as the concepts of ones that are built into MPC-HC and those that are external. All these DirectShow filters have ‘pins’ which are their inputs and outputs – their connection points in other words. Each pin has a defined list of media types it will and won’t accept. As long as you comply with this, they can be threaded together to create a ‘graph’. The simplest way to illustrate this is with a screenshot of the aptly named GraphStudio, and this example shows the combination of filters I used to make one of the sample audio clips earlier in this post:

So how can we construct a similar sequence in MPC-HC? In the end I finally found the crucial bit of information in a single sentence of the excellent self-explanatory and unofficial All the things you may want to know about Media Player Classic – HomeCinema:

When a video file is loaded in MPC-HC, MPC-HC will run through this list from top to bottom and load the relevant filter(s), create a graph from them and play the file.

Bingo! All you need to do is explicitly list them in the right order in MPC-HC’s External Filters window and MPC-HC should thread them together, compatible pins permitting. Sure enough, it works.

Would you believe it, there is yet another hitch – the CyberLink Audio Decoder expects LPCM input channels to be in a certain order, one that differs from the default order in ffdshow. This is trivial to fix, though it will mess things up if you rely on ffdshow to decode other media formats.

 

The guide

You’ll need MPC-HC obviously, the CyberLink Audio Decoder will need to be installed (from PowerDVD), and you’ll need ffdshow tryouts installed (I used the SVN release, since the beta is years old).

Once ffdshow is installed, open up its Audio Decoder configuration utility from the Start Menu. In the Output section select 16bit LPCM and apply.

Disable the Mixer and configure the Swap Channels menu as follows. Note the different order:

Open MPC-HC and hit O to bring up the options menu. In the Internal Filters section de-select AAC, AC3 and DTS from Transform Filters on the right.

UPDATE – Contrary to what I had originally written here, do not disable the built-in audio switcher! I hadn’t understood that this is needed for when you have a video file with multiple audio tracks. If it’s not enabled then all audio tracks play simultaneously. You could consider disabling Regain volume if you want to minimize the amount of additional processing.

Audio switcher settings

In the External Filters section make sure that ffdshow is set to prefer, and is listed above CyberLink Audio Decoder (also set to prefer). Use Add Filter… to set Microsoft DTV-DVD Audio Decoder to Block.

Remember that DTS audio bitstreams don’t require the ffdshow treatment. To avoid having to reconfigure this for different movie formats we can customize the recognized media types for the ffdshow filter. As per the screenshot above, select ffdshow Audio Decoder then scroll down until you find MEDIASUBTYPE_DTS and delete it. DTS files will now skip ffdshow and will be entirely handled by CyberLink Audio Decoder. If you ever need to revert this change click Reset List.

Open a movie file in MPC-HC, then select Play -> Filters -> CyberLink Audio Decoder and you will be able to select Dolby Headphone like so:

On the next tab you can choose between three DH modes. I found a nice succinct guide to the three modes here:
http://www.head-fi.org/forum/thread/444681/headphones-with-good-sound-stage-better-with-dolby-headphone-or-no-need-for-it#post_6003214

Sadly it seems that every time you load a new file into MPC-HC you need to re-enable Dolby Headphone (the setting doesn’t stick for some reason). Also, owing to the channel order swapping in ffdshow you’ll find that in ordinary stereo mode you’re only getting the Front Left and Front Center channels. As a result you’ll probably want to de-select the Swap Channels setting in the ffdshow Audio decoder tool when you’re not using headphones. A small price to pay though… Enjoy!

 

Further reading

There is a guide to using Dolby Headphone for listening to two channel music in the audio player foobar2000 here:
http://www.head-fi.org/forum/thread/447089/5-1-headphone-experience-foobar-configuration-for-all-stereo-music-files

I’ve given it a try and I don’t really think it’s worth it. When I had a actual surround system I used to play all my music on Dolby Pro Logic IIx and it sounded very good using all the speakers. It meant you could be sitting anywhere in the room and still get nice separation and so on. However, creating those additional channels only to merge them back down to two channels often doesn’t seem to add much since they were virtual to start with. In side by side listening comparisons I often preferred the original stereo mix, but admittedly it does seem to vary with the way they’ve been mastered (remember, to hear the original stereo you have to remove all selected DSPs, not just DH).

DXVA VC-1 playback on Intel GMA 500

This will only work on Vista or Windows 7. I suggest using the following test clips since they are already on your computer if using Windows 7:

  • C:\Users\Public\Videos\Sample Videos\Wildlife.wmv
  • C:\Windows\Performance\WinSAT\Clip_1080_5sec_VC1_15mbps.wmv

As you can see from the DXVA Checker tool, the GMA 500 can decode VC-1 in hardware. Though Windows 7 includes DXVA hardware assisted playback of H.264 out of the box, for some reason it only considers the GMA 500 capable of VC-1 motion compensation acceleration which is a small part of the entire decode process – so VC-1 playback is choppy.

The good news is that for Windows Vista Intel released a bundle of DXVA codecs for the GMA 500. They’re not available from the Intel drivers website but fortunately Sony’s US site has them. The installer will only extract the drivers if it’s running on a Vaio P, but you can use a tool like Universal Extractor to unpack them (look in \tempexefolder). On Windows 7 you will need to run Setup.exe in Vista compatibility mode otherwise it will fail.

Once the decoder is installed you may notice that you cannot get it to work in Media Player Classic Home Cinema, even by forcing it to be the preferred decoder (as with H.264 in my other post). This is because MPC-HC works with the DirectShow multimedia framework, but the Intel VC-1 decoder is written for Media Foundation – Microsoft’s replacement framework which launched with Windows Vista.

This unfortunately means that you’re limited to using Windows Media Player for hardware accelerated VC-1 content, so subtitles are not going to be possible. The next problem is that WMP aggressively selects its own decoder in favour of the Intel one. There is no neat way to set preference order as with DirectShow, so we need to make some Registry edits.

Open Regedit and navigate to HKLM\Software\Classes\MediaFoundation\Transforms\Preferred.

Export the whole branch and keep it somewhere safe (say foundation-orig.reg). Still in Regedit, right-click on this Preferred key and edit the permissions. Take ownership (Advanced > Owner tab), then grant Full Control to Administrators.

At the level \Transforms notice that there is an entry with a long alphanumeric CLSID for each registered decoder. Find the one called WMVideo Decoder MFT, which should be {82d353df-90bd-4382-8bc2-3f6192b76e34}. Find the CLSID for Intel® Media Codecs VC-1 Decoder for Intel® System Controller Hub, which ought to be {2b53d708-ffe1-4da3-b3a8-f8ec247c374f}.

Using Notepad, load the registry backup of the Preferred key you exported. This is a list of video formats also represented by CLSIDs, together with the CLSID of the decoder which will be used to play them back. So all we need to do is replace all instances of {82d353df-90bd-4382-8bc2-3f6192b76e34} with {2b53d708-ffe1-4da3-b3a8-f8ec247c374f} and save as foundation-mod.reg (always keep the original just in case!). Then double-click it and commit the changes.

Now if you run DXVA Checker and click on Check DirectShow/MediaFoundation Decoders at the bottom and browse to a VC-1 clip, you should see the following:

Intel Media Codec VC-1 DXVA

Note that some guides will tell you to take ownership then rename the file C:\WINDOWS\SYSTEM32\WMVDECOD.DLL which may well achieve the same result, but it will break the Windows Experience Index test process – it plays a WMV clip with this decoder during the benchmark and will fail with an error if that file is missing.

By switching between the original and modified .reg files and comparing playback you’ll notice that the Intel VC-1 decoder uses around 50% CPU on a 1.33GHz Atom Z520 Vs. 100% and stuttering with the Windows one.

Update – the Intel decoder seems to have difficulty rendering crossfades, as you can see from the artifacting while playing this nVidia demo clip and some of the content on the Microsoft WMV HD content showcase. It’s a shame the decoder doesn’t seem to be actively maintained, however all of these clips are years old so perhaps they were encoded with immature encoders.

Update 2 – I have since noticed that the clips from Microsoft’s showcase and that nVidia one are not in fact VC-1. They’re WMV3 which was a slightly earlier codec. The true VC-1 clips which I have tried are decoded without artifacts. You can check the video codec used in a file by running ffmpeg -i on them.

Continue to DXVA H.264 playback on Intel GMA 500 with subtitles (Windows 7)

DXVA H.264 playback on Intel GMA 500 with subtitles (Windows 7)

Update – This guide was updated on 04/04/2012

Out of the box, Windows 7’s Windows Media Player (WMP) will play HD video using the Intel GMA 500 and DirectX Video Acceleration (DXVA) to do the decode. Using the Matroska Splitter you will also be able to play MKV files. However, they may occasionally stutter and use a fair amount your humble Atom Z series CPU’s power (around 40-50% of 1.33GHz), and you won’t be able to use subtitles.

The PowerDVD H.264 decoder on the other hand will use about 10-20% less CPU, is less prone to locking up, and by using Media Player Classic Home Cinema (MPC-HC) you gain subtitle rendering support. Apparently PowerDVD does itself support MKVs with subtitles but on the several occasions I have attempted this with the trial version it has locked up and crashed. If you don’t have the PowerDVD decoder, you can use the ‘ffdshow tryouts’ open source decoder which is a very good alternative, but seems to suffer some screen tearing during high motion scenes while subtitles are enabled.

Ingredients

  • Media Player Classic Home Cinema (MPC-HC 1.60.4014 at the time of updating this document) – don’t confuse with Media Player Classic, this is a separate version
  • Matroska Splitter (optional) – this reads the MKV container format. MPC-HC has its own implementation included but you could use this if you want to play MKV files in Windows Media Player
  • Optional DirectVobSub subtitle renderer for Windows Media Player (will not work for MKVs), useful for Xvid/DivX files though
  • PowerDVD’s H.264 decoder CyberLink Combo MPEG-2/H.264/VC1 Decoder v.1.0.4960.3320
  • or ffdshow tryouts decoder – don’t use the beta release, it doesn’t have the DXVA decoder. I tested with the SVN build.
  • DirectX End-User Runtimes (June 2010) – required for the EVR Custom Presenter renderer which is needed for subtitle compositing

Method

Firstly disable Aero.

If you want to have subtitles in WMP for Xvid/DivX movies then download and register vsfilter.dll. To do this, copy the DLL to C:\Windows\System32 and open a Command Prompt using right-click & “Run as Administrator”. Then type
regsvr32 c:\windows\system32\vsfilter.dll

If later on you want to remove this, just open the Command Prompt as Administrator and type
regsvr32 /u c:\windows\system32\vsfilter.dll

When it’s registered you can open an Xvid AVI file in WMP and, as long as there’s an SRT subtitle file with the same filename as the AVI then you will see your subtitles. There will be a new icon in the system tray which will allow you to toggle subs, as well as choose the language if there are several sets of subs.

Now install Haali Splitter if you want MKV support in WMP and other players. When you load a MKV, it behaves in a similar way to VSFilter (icon in systray), except it’s even more versatile since MKV containers can have different soundtracks too.

Next, install MPC-HC.

Now use WinRAR to extract the DirectX End-User Runtime file you downloaded. In WinRAR, select File > Open, then change the filename dropdown from All archives to All archives including self-extracting. Browse to your downloaded directx_Jun2010_redist.exe and open it. Inside you will find some more archives. Drag and drop to extract the file Jun2010_d3dx9_43_x86.cab, then open this in WinRAR too. Extract the file d3dx9_43.dll into the folder C:\Program Files\Media Player Classic – Home Cinema.

Finally, install the Cyberlink H.264 decoder or ffdshow. During setup ffdshow will offer a choice of decoders to use, pick libavcodec (not ffmpeg-mt).

Now we need to configure MPC-HC. Load it then go to View -> Options.
Go to Playback, and make sure Auto-load subtitles is set (assuming you want them). Note that you can also set language code preference orders for audio and subs:

Auto load subtitles

Move to the section called Output. If you will never use subtitles select EVR and don’t touch anything else.
If you do want subtitle support, use EVR Custom Presenter, reduce the EVR buffers from 5 to 4, and check the Alternative Vsync and D3D Fullscreen boxes. With the default settings the additional load of compositing subtitles brings the framerate down below 24fps, however by using these last two options we can just maintain 24fps.

Output settings

Now select the heading Internal filters and uncheck both H.264 options on the right. This stops MPC-HC using its own support for those features, since we’re going to use external modules for those. If you’re using the CyberLink Video Decoder version I posted above you can optionally uncheck the MP4/MOV and MKV source filters which will cause the CyberLink ones to be used instead (it doesn’t seem to improve performance).

Internal filters

Under the heading External Filters click Add. Then browse to the CyberLink Video Decoder and add it. Make sure to set it to Prefer on the right as shown. If you’re using ffdshow then instead add ffmpeg DXVA video decoder an set to Prefer.
If you installed the Vsfilter.dll subtitle driver (some other media players/codec packs will register this) we need to add DirectVobSub (auto-loading version) too, but select Block on the right. This prevents it from loading, since we’re using MPC-HC’s subtitle renderer. Apparently the way DirectVobSub renders is fundamentally incompatible with DXVA:

External filters

Close MPC-HC for the settings to take effect. At this point it’s a good idea to associate .mkv files with MPC-HC. If videos are launched by double clicking like this, when you pin MPC-HC to your Start Menu it will have that child menu showing you the last ten or so files you launched which is very useful.

Start an H.264 encoded MKV in MPC-HC and as it starts to play, right-click on the video window and select Filters -> CyberLink Video Decoder. Check that DXVA is selected. I believe that HAM mode uses OpenCL on GPUs that support it (the GMA 500 doesn’t) which if I remember was recommended for ATI GPUs, the early ones having glitchy DXVA implementations apparently. If you’re using EVR Custom Presenter you wont be able to do this with D3D Fullscreen enabled, so toggle it and reload MPC-HC to verify this step.

CyberLink decoder filter settings

Close and reopen MPC-HC and you should be done! Though using D3D Fullscreen reduces tearing and seems to keep the framerate higher when using the EVR Custom Presenter renderer you cannot right-click and see the normal MPC-HC GUI elements. You have to use Ctrl-C to exit playback to modify settings. Two essential keyboard shortcuts are A to switch audio track, and S to switch subtitle track, though shortcut keys do exist for just about everything, and can be customised in the Player > Keys menu in Options.

If using ffdshow you also need to enable hardware acceleration by running Start Menu > All Programs > ffdshow > DXVA video decoder configuration:

DXVA decoder settings

ffdshow’s built-in subtitle rendering seems to produce smeary artifacts on the picture so ignore those options and use MPC-HC’s subtitles instead.

If you have a video that won’t playback nicely with this setup then it’s likely that the bitrate is too high for the GMA 500 to cope with (a straight 1:1 rip from Blu-ray for instance) or perhaps the file has not been encoded to be fully DXVA compliant (quite likely with older stuff). Framerates over 24fps cannot really be played unfortunately.
There are some H.264 movie trailers available here for testing.
In my experience the GMA 500 in my VAIO P will play most 1080p content perfectly well, even outputting to a TV at 1920 x 1080. If in doubt about whether it’s dropping frames, while using EVR Custom Presenter you can press CTRL-J several times to view the frame rate (get rid of the graph and verbose text – they slow it down even more!).

Further reading

This handy guide explains in detail what all the options in MPC-HC mean.

Continue to DXVA VC-1 playback on Intel GMA 500 or learn how to get a surround sound experience from ordinary headphones.