There is a nice Visual Studio extension Image Watch.
It can take an arbitrary address in RAM and show its contents as an image with @mem
operator.
@mem(address, type, channels, width, height, stride)
: interpret raw memory as pixels, starting ataddress
(UINT64
), with channeltype
(see Pixel Formats), number ofchannels
(UINT32
),width
(UINT32
),height
(UINT32
), andstride
(UINT32
). Example:@mem(myimg.data, UINT8, 1, 320, 240, 320)
According to the help page, it can display several complex pixel formats, BGR, NV12 and YV12 are among them.
Optionally, a format string may be associated with the pixel format. It specifies the semantics of each channel for rendering:
RG, UV
RGB, BGR, YUV
RGBA, BGRA
...
A number of special YUV formats are supported as well. In this case, the format string also defines the data layout.
NV12 (two planes: one Y plane, one packed UV plane, subsampled by 2 in both dimensions)
YV12 (three planes: one Y plane, one packed U and V plane each, both subsampled by 2 in both dimensions)
However, it is not clear for me, how to make Image Watch to display images in NV12
and YV12
formats with @mem
operator.
Help page does not contain too much information.
I've managed to display gray single channel images, specifying UINT8
as a channel type. I can also correctly display BGR image with channel type = UINT8
and 3 channels: @mem(pBGR, UINT8, 3, 640, 480, 640*3)
. This was described in documentation, but was not obvious.
I've tried various combinations of numbers of channels and format strings with or without quotes: @mem(ptr, NV12, 3, 640, 480, 640*3)
, @mem(ptr, "NV12", 1, 640, 480, 640*3)
, @mem(ptr, UINT8NV12, 3, 640, 480, 640*3)
@mem(ptr, NV12UINT8, 1, 640, 480, 640*3)
, etc - no luck. I see only gray rectangle with the word [invalid]
.
Same thing with YV12
.