DirectX9 downloading of YUV textures to system memory
I need to retrieve a IDirect3DSurface9 with a YUV format (Actually, NV12) coming from DXVA2. I am currently using LockRect on the video memory surface, and I can access the pixel data successfully, however, the formatting of this data is unclear to me.

In NV12 the Luminance plane comes first, and each line has the stride indicated by the Pitch in the D3DLOCKED_RECT structure. Then comes the chrominance information.

However, I found that on the NVidia and Intel GPUs I have tried, before starting reading the Chroma I need to add some padding, i. e., the number of Luma lines is rounded up to the nearest 16 multiple. Of course, on the ATI cards I have tried, this padding does not exist.

Has anyone ever tried to download a YUV surface? Any idea on what hardware query can I make to find out about this luminance padding? Knowing the total size of the memory locked by LockRect would be helpful, for example. Any specification whatsoever anywhere?

(Please do not tell me to download in RGB)

Many thanks in advance!
DirectX9 downloading of YUV textures to system memory
===

I need to retrieve a IDirect3DSurface9 with a YUV format (Actually, NV12) coming from DXVA2. I am currently using LockRect on the video memory surface, and I can access the pixel data successfully, however, the formatting of this data is unclear to me.

In NV12 the Luminance plane comes first, and each line has the stride indicated by the Pitch in the D3DLOCKED_RECT structure. Then comes the chrominance information.

However, I found that on the NVidia and Intel GPUs I have tried, before starting reading the Chroma I need to add some padding, i. e., the number of Luma lines is rounded up to the nearest 16 multiple. Of course, on the ATI cards I have tried, this padding does not exist.

Has anyone ever tried to download a YUV surface? Any idea on what hardware query can I make to find out about this luminance padding? Knowing the total size of the memory locked by LockRect would be helpful, for example. Any specification whatsoever anywhere?

(Please do not tell me to download in RGB)

Many thanks in advance!