Results 1 to 5 of 5

Thread: conversion yuv to rgb or bmp to data raw

  1. #1
    Guest

    conversion yuv to rgb or bmp to data raw

    hi, im using the yuv color space in a project to implement a video player, but I canīt convert correctly the yuv data to rgb using the various algorithms from the web. I have found one that convert yuv to bmp data (24 bits/pixel), but it doesnīt work, the image appears wrong. Does anybody know how to convert yuv data (4:2:0) in data raw? Or, does anybody know any function that convert bmp data in data raw, which can be displayed correctly?

  2. #2
    Guest

    Re: conversion yuv to rgb or bmp to data raw

    Let me guess:

    You are using Windows, right?
    Are you aware that Windows uses BGR rather then RGB?

    I strongly believe BGR is just an acronym for Bill Gates Rulez

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: conversion yuv to rgb or bmp to data raw

    Originally posted by BGR:
    Let me guess:

    You are using Windows, right?
    Are you aware that Windows uses BGR rather then RGB?

    I strongly believe BGR is just an acronym for Bill Gates Rulez
    It's not so much that Windows uses BGR, as much as it is that the BMP file format uses BGR. But then, so does the TGA file format. Also, the BMP file format was co-developed by both Microsoft and IBM. (Thus the flag in the BMP header for OS/2 BMPs)
    Deiussum
    Software Engineer and OpenGL enthusiast

  4. #4
    Guest

    Re: conversion yuv to rgb or bmp to data raw

    Originally posted by Deiussum:
    It's not so much that Windows uses BGR, as much as it is that the BMP file format uses BGR. But then, so does the TGA file format. Also, the BMP file format was co-developed by both Microsoft and IBM. (Thus the flag in the BMP header for OS/2 BMPs)

    yes, im using windows, but i have tried to change the order of the r,g and b components... but even doesnīt work. Do you know any function to convert the bmp data representation to data raw?

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: conversion yuv to rgb or bmp to data raw

    As I said, it doesn't matter if you are using Windows. Even using Linux, BMP files are still stored in BGR format. It's not a matter of the OS you use, but of the file format you use.

    To convert a BMP file into an array of raw RGB (or BGR) data, you could try either getting a copy of the file format specification and writing your own loader, or use a library that does that for you.

    Once you have the raw RGB data, you should just be able to use the proper conversions to get YUV. (I don't remember what those conversion formulas are offhand, but I'm sure a Google search will turn them up.)

    Edit: Oops. Sorry. You are looking to convert YUV to a BMP? Or YUV to raw RGB data? How are you using the resulting data? Are you just saving it to a BMP file, trying to use it in OpenGL, or what?

    [This message has been edited by Deiussum (edited 11-03-2003).]
    Deiussum
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. conversion of 3D data to 2D data
    By sajis997 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-03-2015, 06:38 PM
  2. ARB to GLSL Conversion
    By jtipton in forum OpenGL: GLSL
    Replies: 0
    Last Post: 10-30-2009, 10:13 AM
  3. coords conversion
    By christus in forum OpenGL: General
    Replies: 2
    Last Post: 02-28-2007, 01:30 PM
  4. Type conversion
    By Orzech in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-25-2004, 07:02 AM
  5. conversion...
    By method5 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-24-2002, 06:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean