Attila T. Áfra's blog about pixels, voxels and threads

ICC color management in Media Player Classic Home Cinema

with 26 comments

Display calibration and profiling are becoming more and more popular thanks to relatively cheap colorimeters and wide gamut monitors. It’s important to know that an application must support color management in order to display accurate colors.

While most of the popular graphics editors, viewers and web browsers have this feature, I haven’t heard about any video players with ICC color management. So, I’ve decided to implement this in one of the most popular open source media players for Windows: Media Player Classic Home Cinema, or simply MPC-HC.

The problem with current color management systems (CMSs) is that they use the CPU. Even with lookup tables and SIMD optimizations, they are quite slow. Way too slow for real-time HD video playback. Fortunately, color management can be implemented very efficiently on the GPU.

The ideal solution would be to write a GPU-optimized CMS from scratch, but that’s a lot of work and I’m too busy right now with my ray tracing stuff. A much easier way is to build a 3D LUT with an existing CMS (I’ve opted for Little CMS), which you can sample in a little pixel shader to transform the pixels. 3D LUTs are frequently used in the film industry and are starting to get serious attention in the gaming industry too.

I’m using a 64x64x64 LUT with 16-bit per channel floating point entries, which provides results virtually indistinguishable from those obtained directly with Little CMS. Trilinear interpolation is crucial, and it’s natively supported for this texture format by most (if not all) GPUs released in the past few years. I’ve also added dithering as a final pass to avoid introducing banding artifacts.

GPU accelerated color management has been introduced in the latest stable version (1.4) of MPC-HC. If you experience some problems with that, you should download a recent SVN build. Make sure to select the EVR Custom (recommended for Vista and 7 users) or the VMR-9 (renderless) renderer in View -> Options -> Playback -> Output. Then, you can enable color management in the View menu as shown above. For a detailed description of the renderer settings, please check out the wiki.


Written by Attila Áfra

September 20, 2010 at 10:36 am

26 Responses

Subscribe to comments with RSS.

  1. That is really awesome and actually working quite good.
    Excellent work!
    Finally, there is real video color on a wide gamut display.
    For some years now I thought, it should be possible to do color management using shaders and I actually expected ATI (less Nvidia) to support it in their video accelerator chain eventually.
    Since it’s “only software” 🙂


    November 2, 2010 at 10:49 am

  2. Hello,

    Fantastic work! Any you still going to release an executable demo of your VoxLOD engine with GI?



    December 8, 2010 at 3:13 pm

    • Thanks! Eventually, yes. It still needs some polishing to make it a bit more user friendly. Currently, I’m quite busy with my new research project. 😉

      Attila Áfra

      December 17, 2010 at 3:33 pm

      • That’s great! Have you thought about porting the ray tracing and Monte Carlo GI calculations to the GPU or is that not feasible because of the huge amount of memory that the massive model needs?


        January 1, 2011 at 10:09 pm

  3. Hi, sorry for bothering you again. I’m still impatiently looking forward for that exe of VoxLOD 😉 The technology looks really interesting and I would love to try it!


    March 4, 2011 at 11:37 am

  4. Neither version works. Render Setting/enabled is greyed out. Changing anything in GPU didn’t enable it.

    MP wants to install the “latest” DX10 update. Here’s what all DX updates do to do my WinXP system: (a) replaces my capture card’s VFW/WDM capture files so that VirtualDub no longer recognizes my card. Have to completely uninstall all graphics card software and reinstall. (b) Removes ICC profiles from Color Management list and replaces them with monitor’s OEM ICM profile, or with sRGB. (c) Disables my onboard Calman signal generator. Must download newest version to match the new DX, then reinstall. (d) For some unknown reason it renders AviSynth largely useless. Have to uninstall/reinstall.

    I might try this when I have a day to waste on it, but until I understand why Render Settings/Enable is greyed out, I don’t thinki all that work would fix it.

    WinXp/SP3, ATI 9600XT AIW

    S J Romeo

    April 20, 2011 at 2:37 pm

  5. Hi, what’s the requirement of DirectX version supported by graphics cards? It works greatly on my desktop (Win7 / NVIDIA 9600GSO) and MacBook Pro, but fails on my old laptop (ThinkPad X61, Win7 / Intel GM965). This graphics chip supports DirectX 9.0c / SM3.0. Is there any advices?

    Valent Lei

    October 11, 2011 at 5:34 pm

    • Hi! Unfortunately, the Intel GM965 does not support bilinear interpolation for floating point textures, which is necessary for color management.

      Attila Áfra

      October 12, 2011 at 9:50 pm

  6. I used to be able to find good info from your blog articles.

    Noticias Kpop

    June 13, 2012 at 3:09 pm

  7. There is not Mac version… 😦


    November 13, 2012 at 9:26 am

  8. Excellent work, Attila! Congratulations.
    One question: what does the plugin exactly does? Does It assume the frame is in sRGB color space and converts it to monitor profile?



    February 14, 2013 at 11:45 pm

    • Thanks! It tries to detect the color space (Rec.709 or Rec.601) from the resolution, but you can easily override that. And yes, it converts it to the monitor profile.

      Attila Áfra

      February 15, 2013 at 12:01 am

      • Thanks Attila for your excellent work and for replying.
        I’m writing a book about monitor calibration for photographers and I’ll credit you as author of this plugin. In last chapter I talk about configuring software to take profit of the monitor profile.
        I’m sorry, it’s only in Spanish: http://www.hugorodriguez.com/index_libro_4-calibrar_monitor_2a_ed.php


        February 15, 2013 at 1:12 pm

      • That’s awesome! I’ve been using MPC-HC for years and didn’t realize that this feature was here for a while now. Now that Canon DSLRs can achieve raw video recording with Magic Lantern, I’ve been messing with color calibration and color spaces when converting each frame. At first I thought, “meh, sRGB is close enough to rec.709 and video isn’t color managed anyway,” but now I realize that I should probably convert the final image to Rec.709 (from http://www.color.org/rec709.xalter) and encode it in x264 with the flags on for the most accurate rendition possible. BTW, is this the correct profile to use? It *looks* pretty accurate when comparing a frame directly from MPC-HC and a color-managed app like Photoshop, but I’m not 100% certain.

        Anyway, thank you for making this happen!


        May 25, 2013 at 7:35 pm

      • I’m glad you find it useful! Yes, that should be the correct color profile.

        Attila Áfra

        May 30, 2013 at 1:50 pm

  9. i also have the problem on xpx64 with nvidia gtx560ti that color management is greyed out.
    I am stick to use of Directx 9c. Is there any solution ?


    May 9, 2013 at 2:00 pm

  10. Atilla,

    Is there any way to contact you in person (email)?

    James Freeman

    October 11, 2013 at 2:47 pm

  11. Hi!

    When would I need to enable color management in Media Player Classic? I have calibrated my display to sRGB standards (D65, gamma 2.2) with Spyder4Pro + dispcalGUI/ArgyllCMS and my profile is applied system-wide (I’m using Windows 7). My panel is normal gamut.

    If I enable color management, I can see changes in colors. For example, in the Digital Video Essentials PAL DVD, at the pattern with the alternating magenta and green bars, color management makes megenta a lot more saturated. I don’t even know how it is supposed to look.

    Is color management needed for sRGB displays or does it only apply to wide gamut monitors?

    Thank you very much in advance!


    January 5, 2014 at 6:14 pm

    • Hi! You should enable color management for sRGB displays as well. Photoshop and similar apps do the same, but they have color management enabled by default. Applying the profile system-wide is not sufficient.

      Attila Áfra

      January 5, 2014 at 6:25 pm

      • Hello!

        Thank you for your immediate reply! I was expecting a notification by email, but it never happened…

        It took me a couple of days to truly understand how monitor profiles work. I was watching movies with sRGB tone response curves all these years… It will take some time to get used to the darker 2.4 gamma. Also, I wasn’t imagining that yellow cast in my movies when I got my new monitor. It seems my monitor’s gamut extends too much in the green/yellow region. Color management took care of it 🙂

        At last, webpages (using Firefox), photos (ACDSee Pro) and movies (MPC-HC) look right. I’m still unsure what to do about games though. I know that they aren’t color managed so I can’t expect exact colors, but what gamma setting should I use? sRGB curve, 2.2 or 2.4? My guess would be sRGB, but then, everything being a console port lately, it wouldn’t come as a surprise if they are optimized for TV gamma. This is all so confusing!

        Thank you very much once again for this wonderful code!


        January 9, 2014 at 12:34 am

      • I would recommend calibrating the display to a gamma of 2.2, which should be fine for games and other non-managed apps. I would set the gamma to 2.2 in the MPC-HC settings as well. That’s the *final* gamma, which is independent of the calibration gamma. I think 2.4 is too dark in most cases.

        Attila Áfra

        January 9, 2014 at 1:52 am

  12. Thanks a lot! You’ve been very helpful!

    One last thing though… My calibration software suggests to use 5000K at 90 cd/m^2 for a dark room. I guess this comes at a conflict with the D65 point of Rec.709? Should I use two different calibration settings for photos and movies? Or should I ignore the software suggestions and calibrate to D65 anyway?

    Thanks again for your time! I look forward to your reply!


    January 9, 2014 at 1:28 pm

    • I suggest to use D65.

      Attila Áfra

      January 11, 2014 at 2:15 pm

      • Thanks…

        How does the rendering intent option work? Every mode looks the same to me. I’m using profiles from Spyder4Pro and dispcalGUI. What am I missing? Should the intent be specified in the profile beforehand?


        January 11, 2014 at 5:01 pm

  13. So, I have discovered that rendering intent modes only make a difference when using XYZ LUT profiles. However colors don’t look the same, especially near the black region, as they do with matrix profiles. Do you have any experience with ArgyllCMS and dispcalGUI? Are there any suggested settings to use with the MPC-HC color management? I’m mainly talking about this screen:


    January 23, 2014 at 3:38 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: