-- vLAB 001 - bitmap data to YUV file (stream or other) --
Looking for some simple Delphi code to convert my RGB bitmap
to a YUV bitmap. That is, I know how to convert the RGB to YUV.
But, I'm not sure of the layout of the bitmap, to lay out the
YUV. I realize that it's probably a STREAM that I need to create,
(ie, bitmap.yuv) for instance.
.
I want to convert to YUV, save it. Then, read it in again, back
into RGB.
For intance, if I have a 5x5 RGB pixel bitmap, and I want to convert
it to YUV, the storage format (Row x Col) is:
The numbers (1 through 5) are the pixel places, and I think thatCode:1 2 3 4 5 1 [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] 2 [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] 3 [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] 4 [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] 5 [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V] [Y][U][V]
the YUV is one pixel - though I'm confused
Any help would be greatly aprecated. Thanks.
Cheers,
-vhelp 3274
+ Reply to Thread
Results 1 to 4 of 4
-
-
I don't know it either, but you can use avisynth + imagereader/imagewriter with a very small bitmap (like your 5*5) and have a look to the layout in the saved bitmap (can be saved as yuv!)
GUI for dvdauthor:
https://www.videohelp.com/~gfd/ -
..(can be saved as yuv!)
I would like to make a standard YUV format file. (be it bitmap or stream)
whatever format/structure they usually are made in. Its all very confusing
to me at the moment. I think all I need to *see* the picture is the
actual layout of the numbers/pixels.
I do have a few samples (why I didn't think of it in the first place)
but I don't think they are standard format in structure. They are all
based on a STREAM. YV12; YVU9; and 411 and something else I think (from
one of those Borland or efg sites, I think)
I could "re-create the wheel" by making my *own* format (stream or something)
(I was thinking of this) but if others want to open the YUV file w/ standard
or commercial tools of there preference, then my home-brew will not open or
convert properly them.. not that I'll be distributing any, but you never know
who might want to D/L such files for there own purposes/studies. And, I'd like
for it to be accurate for there own tools and studying
Below is an example of a format I was working on.
( maybe I'll start my own LABS :P )
Given my 5x5 bitmap layout (above post) but we'll use a 2x4 (2 col, 4 row)
for space purposes. I was hoping to duplicate it, but I'm still confused.
I'm not sure if this is a Planar or Packed format.
411 FORMAT
[Y][Y][Y][Y]
[Cb][Cr]
or
[Y][Y][Y][Y]
[Cr][Cb]
or
[Y][Y][Y][Y]
[U][V]
or, if in a file, the sequence ? would be similar like this..
Code:- 1 - - 2 - 1 - [Y][Y][Y][Y].[U][V] [Y][Y][Y][Y].[U][V] 2 - [Y][Y][Y][Y].[U][V] [Y][Y][Y][Y].[U][V] 3 - [Y][Y][Y][Y].[U][V] [Y][Y][Y][Y].[U][V] 4 - [Y][Y][Y][Y].[U][V] [Y][Y][Y][Y].[U][V]
.. to YUV and store it in any kind of file container I design (but don't forget
.. the note above, why I don't want to go that way, unless I have to)
RGB pixel layout:
Code:-1- -2- 1 - [RGB][RGB] 2 - [RGB][RGB] 3 - [RGB][RGB] 4 - [RGB][RGB]
R=255; G=255; B=255
Y = (R255*.3)+(G255*.6)+(B255*.1) = 255
U = ( 0.493 * (B - Y) )
V = ( 0.877 * (R - Y) )
So, Y=255; U=0; V=0; Thus, our first set of YUV data layout, as observed
over the "underline" (if I understood the process correctly, and using the
planar_or_packed format) would be:
Code:[255][Y][Y][Y].[0][0] [Y][Y][Y][Y].[U][V] ---------------------
layout. If I learn anything new, I'll revise and bring to light.
Comments, anyone ??
-vhelp 3284
EDITED - Sat - 11:59pm -
I'm not sure if there is anything like a real standard for YUV bitmap data. Even for Streams (where this format is at least 'common') there are several "standards" (as you have mentioned already): YUV 4:4:4, YUV 4:2:2, YUV 4:1:1.
I think to have the best conversion, use should use YUV 4:4:4
There are also some (commercial) graphic conversion programs that support YUV data. This could also be seen as 'standard':
http://64.233.183.104/search?q=cache:w-et91QGY2sJ:www.pcsupport.dk/software/GraphicsCo...e+format&hl=deGUI for dvdauthor:
https://www.videohelp.com/~gfd/
Similar Threads
-
[C++/Python] How to save BMP Stream to file?
By manzati93 in forum ProgrammingReplies: 0Last Post: 9th May 2011, 10:45 -
PS3 MPEG4 AVC - RGB or YUV?
By Colmino in forum Newbie / General discussionsReplies: 1Last Post: 28th Jun 2008, 14:50 -
Separation of YUV and RGB video components
By Dave1024 in forum ProgrammingReplies: 0Last Post: 24th Jun 2008, 04:19 -
App to identify whether a video is RGB or YUV?
By Colmino in forum Newbie / General discussionsReplies: 2Last Post: 12th Jun 2008, 23:52 -
Optimized Conversion between YUV and RGB
By Dave1024 in forum ProgrammingReplies: 14Last Post: 27th May 2008, 01:40