Thread: Converting from YUV 420 P to 24-bit RGB

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    26

    Converting from YUV 420 P to 24-bit RGB

    Hello, I am trying to do a conversion of a file format. I know that it is in YUV 420 Planar format, but I need to convert it RGB. I know there are all these formulas and algorithms out there, but I do not know how to derive the exact R, G, or B from each pixel. Or if that is even possible. Can anyone guide me in the right direction??

    Thanks,
    Chris

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Did you try using google? This page comes up as the first one:
    http://www.fourcc.org/fccyvrgb.php

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    VirtualDub is open source project that has all these possible conversions from format to format. You can download the code and look for the function you need
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User
    Join Date
    Aug 2008
    Posts
    26
    Mats, yes I searched and I have been to that website. I would be able to follow those formulas but I cannot extract my Y, U, and V so I wouldn't be able to satisfy those formula requirements.

    I am looking into VirtualDub which should be what I need, thank you.

  5. #5
    Registered User
    Join Date
    Aug 2008
    Posts
    26
    Well after looking at the VirtualDub requirements I cannot use it. I am on a Linux machine and do not have Visual Studio 2005...

  6. #6
    Registered User
    Join Date
    Aug 2008
    Posts
    26
    I am also trying to do this in C.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I can't tell you how to extract the data, but this may help a bit:
    http://www.transcoding.org/cgi-bin/t...de?ColorPlanes

    For doing any work like this, you'd obviously need to know the file-format of the input file you are using, but often it says something like "this block is stored in XYZ format", and then you need to understand how XYZ works.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Porting from 32 bit machine to 64 bit machine!
    By anoopks in forum C Programming
    Replies: 10
    Last Post: 02-25-2005, 08:02 PM
  2. Converting an unsigned int to to unsigned long long (64 bit)
    By ninjacookies in forum C Programming
    Replies: 18
    Last Post: 02-11-2005, 12:09 PM
  3. bit patterns of negtive numbers?
    By chunlee in forum C Programming
    Replies: 4
    Last Post: 11-08-2004, 08:20 AM
  4. Converting 24bits RGB to 8 bit Grayscale
    By FearOfTheDark in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 01-29-2003, 06:17 AM