|
|
INDEX F.A.Q. SEARCH LATEST POSTS
Rules Register Profile Private messages Login
| Author |
Message |
vhelp ..Semi Neutral..
Joined: 31 Mar 2001 Location: New York
|
|
-- 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:
| Code: |
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 numbers (1 through 5) are the pixel places, and I think that
the YUV is one pixel - though I'm confused
Any help would be greatly aprecated. Thanks.
Cheers,
-vhelp 3274
Last edited by vhelp on Apr 23, 2005 10:10, edited 2 times in total
|
|
borax Member
Joined: 20 Apr 2004 Location: Germany
|
|
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:
http://www.videohelp.com/~gfd/
|
|
vhelp ..Semi Neutral..
Joined: 31 Mar 2001 Location: New York
|
|
| Quote: |
| ..(can be saved as yuv!) |
But it wouldn't be the same
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 )
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] |
.. I realize, that I can take a rgb bitmap and convert (pix by pix) the r.g.b
.. 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] |
So, given the the following color information conversion for our first pixel:
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]
--------------------- |
I'm still confused, and I think I have things messed up in the above
layout. If I learn anything new, I'll revise and bring to light.
Comments, anyone ??
-vhelp 3284
EDITED - Sat - 11:59pm
Last edited by vhelp on Apr 23, 2005 23:01, edited 1 time in total
|
|
borax Member
Joined: 20 Apr 2004 Location: Germany
|
|
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.d ... &hl=de
_________________ GUI for dvdauthor:
http://www.videohelp.com/~gfd/
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|