Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Programming and Hacking > Development
Register FAQ Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 16th August 2005, 12:31   #1  |  Link
Inc
Squeeze it!
 
Inc's Avatar
 
Join Date: Oct 2003
Location: Germany
Posts: 472
Order of RGB or YUV Frame values in memory

Question a):

Lets assume I do load rgb data into memory using dgdecode.dll's getRGBFrame() at a memorypointer *rgb24.

Now how is the order of the RGB data in memory:

(RGB24 Like ...

RGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGB ...... etc.

I do know getRGBFrame results in rgb24 data, but just to know how generally rgb32 data is stored )


RGB32 like ...

RGBARGBARGBARGBARGBARGBARGBARGBARGBA ..... etc.


And for YUV via dgdecode.dll's getFrame()

YUVYUVYUVYUVYUVYUVYUVYUVYUVYUVYUVYUV .... etc.

is that right? I think not due 4:2:0 12 Bit allocation?


Question b)

If I do use the VFW API AviFileGetFrame() is there generally a RGB result, no matter if even the Frame in the avi is YUV ?

Would the allocation of Pixeldata using AviFileGetFrame() also be stored as YUV Values in Memory like ...

B = BITMAPINFOHEADER data and its size

BYUVBYUVBYUVBYUVBYUVBYUV .... etc.

?

Thanks for your help


Purpose of all this is that I want to build an autocrop part in a video applikation using the way of directly peeking the memory instead of GetPixe() via API out of a generated Bitmap using SetDIBits() ... I think the peek() approach would be much faster.

Also if I can handle it, I would like to build a histogram window using the peek function on the image data at a given Memorypointer.

Last edited by Inc; 16th August 2005 at 12:35.
Inc is offline   Reply With Quote
Old 16th August 2005, 17:25   #2  |  Link
Wilbert
Super Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,375
Regarding question a:

Quote:
(RGB24 Like ...

RGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGBRGB ...... etc.
It is

BGR BGR ...

Quote:
RGB32 like ...

RGBARGBARGBARGBARGBARGBARGBARGBARGBA ..... etc.
Likewise

BGRA BGRA ...

Quote:
And for YUV via dgdecode.dll's getFrame()

YUVYUVYUVYUVYUVYUVYUVYUVYUVYUVYUVYUV .... etc.

is that right? I think not due 4:2:0 12 Bit allocation?
For YV12 planar: first Y plane, then V plane, then U plane. I guess you know YUY2 (YUYV YUYV ...).
Wilbert is offline   Reply With Quote
Old 17th August 2005, 12:47   #3  |  Link
Inc
Squeeze it!
 
Inc's Avatar
 
Join Date: Oct 2003
Location: Germany
Posts: 472
Ah, yep RGB is ordered as BGR, now I remember, thanks.

But about YV12 and YUY2 ...

Did I understood right that YV12 is ordered as YVUYVUYVUYVUYVUYVU .... ?
But how about peeking these Y V U values in the memory?

I do peek the B,G,R each as Byte including 8bits, but I dont think Y,V,U will be byte,byte,byte ?


Also how are the rows of the image allocated?
Means in case of a 10px width and 4px height image ...

is it a zigzag order? :

00 01 02 03 04 05 06 07 08 09
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39

(above assuming one Number would contain RGB just for demonstration)
Inc is offline   Reply With Quote
Old 17th August 2005, 19:17   #4  |  Link
Nic
Moderator
 
Join Date: Oct 2001
Location: England
Posts: 3,285
No, YV12 is planar....i.e. YYYYYYYYUUVV So all the Ys then the Us then the Vs.

-Nic
Nic is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:40.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.