I want to do this within my own application.
My initial understanding is that I have to use VMR9 and graph builder
using DirectShow. However, after having added a VMR9 filter to a
filter graph I was hoping to enumerate the media types on the VMR9 pin
using EnumPins and then EnumMediaTypes but I get nothing.
Questions:
1- Do I need to first of all to add a decode filter to the graph and
connect it to VMR9 before I can find out what media types VMR9 can
decode?
2- Do I even need VMR9 to access DXVA anyway? My understanding is that
DXVA is only exposed through IAMVideoAccelerator and that itself is
only exposed through either the Overlay Mixer or VMR7 or VMR9.
3- Where is the actual decompression taking place? In VMR9 or some
filter that it is attached to? I'd have thought the latter and yet the
IAMVideoAccelerator interface is on VMR9.
g.
the_...@lycos.co.uk wrote:
> I'm confused about the best way to access hardware acceleration for
> iDCT, MPEG2 decoding and MPEG4 decoding on Windows XP.
>
> I want to do this within my own application.
>
> My initial understanding is that I have to use VMR9 and graph builder
> using DirectShow. However, after having added a VMR9 filter to a
> filter graph I was hoping to enumerate the media types on the VMR9 pin
> using EnumPins and then EnumMediaTypes but I get nothing.
>
> Questions:
> 1- Do I need to first of all to add a decode filter to the graph and
> connect it to VMR9 before I can find out what media types VMR9 can
> decode?
>
> 2- Do I even need VMR9 to access DXVA anyway? My understanding is that
> DXVA is only exposed through IAMVideoAccelerator and that itself is
> only exposed through either the Overlay Mixer or VMR7 or VMR9.
This doc describes the system
http://msdn2.microsoft.com/en-us/library/ms783780.aspx
Essentially you connect the decoder and go from there.
With DXVA 1 (XP) you need the renderer, on Vista DXVA 2(??) can be
accessed outside of it.
>
> 3- Where is the actual decompression taking place? In VMR9 or some
> filter that it is attached to? I'd have thought the latter and yet the
> IAMVideoAccelerator interface is on VMR9.
The IAMVideoAccelerator calls which the decoder filter generates
ultimately end up as calls to the corresponding call in the Motion
Compensation Device Driver as described in this doc
http://msdn2.microsoft.com/en-us/library/ms778818.aspx
The driver then presumably calls the actual hardware which does the work.
Bunny
> This doc describes the system
>
> http://msdn2.microsoft.com/en-us/library/ms783780.aspx
>
> Essentially you connect the decoder and go from there.
>
> With DXVA 1 (XP) you need the renderer, on Vista DXVA 2(??) can be
> accessed outside of it.
Thanks but I had already read the docs you suggested. The first one
states, "The IAMVideoAccelerator interface is exposed on the input pin
of the Overlay Mixer or Video Mixing Renderer (VMR)."
That implies that VMR9 does the decoding, not the decoder filter. What
I don't understand is why when I enumerate the media types on the VMR9
pin using EnumPins and then EnumMediaTypes, I get nothing. So it
appears that I must do something to teh VRM9 object first, like maybe
connect its input pin to another filter, but that seems strange to me
if it is the VMR9's input pin that exposes the IAMVideoAccelerator
interface and thus hold details of the different media supported.
g.
Yes its somewhat confusing terminology, the 'decoder' filter calls the
IAMVideoAccelerator methods which are handled by VMR9, passed to the
driver, the hardware and the work is done. The decoder doesnt actually
do the decoding although it may need to do some depending on what
acceleration is available.
It's the same process for the decoder as with normal software decoding. The
renderer does not advertise any partial types -- the decoder offers all the
types that it can support and the renderer will pick the best.
A decoder that supports DXVA will normally support a range of options from
entirely software decoding through to almost-entirely DXVA decoding, and
these will be represented by the range of output types it offers. In the
DXVA case, as xbunny says, although most of the decoding is done in the
graphics adapter, the decoder still needs to do the first pass and prepare
the correct data for delivery.
G
I currently hav ethe following in my src code:
- CoInitializeEx
- create filter graph
- create VMR9
- add it to graph
- configure VMR9 to be renderless
- configure VMR9 to have just one stream
- next, I want to see what formats VMR9 supports with my GPU so I do
the folowing:
// get input pin
hr = m_pVMR->EnumPins( &pEnum );
if( FAILED(hr))
return hr;
hr = pEnum->Next( 1, &pPin, NULL);
CComPtr<IEnumMediaTypes> pPinEnum;
ULONG fetched;
AM_MEDIA_TYPE media, *pMedia[1];
pMedia[0] = &media;
hr = pPin->EnumMediaTypes( &pPinEnum );
do
{
hr = pPinEnum->Next( 1, pMedia, &fetched);
} while( hr == S_OK );
The value returned by fetched is zero so obviously I've done something
wrong somewhere and I was wondering whether I needed to first create
and add a decode filter to VMR9.
I also tried using GetVideoAcceleratorGUIDs but I get an unknown error
as the result.
g.
> The value returned by fetched is zero so obviously I've done something
> wrong somewhere and I was wondering whether I needed to first create
> and add a decode filter to VMR9.
You've not done anything wrong. As I said, the VMR does not list the
available modes -- most input pins do not do this. This is because partial
media types were never encouraged, and the VMR cannot offer a type without
specifying the dimensions. You need to use a D3D enumeration to determine
what formats are available (or try the formats you are interested in).
> I also tried using GetVideoAcceleratorGUIDs but I get an unknown error
> as the result.
My understanding is that this just work once the d3d device has been
initialized, which I thought should happen when you set the windowless mode
and the default AP is created, but I may not have understood that quite
correctly.
G
the_ethe wrote:
VMR9, DXVA, iDCT
21-??-07
g.
Previous Posts In This Thread:
EggHeadCafe - Software Developer Portal of Choice
Fast KeyWord String searching Algorithms
http://www.eggheadcafe.com/tutorials/aspnet/6cff5442-5432-439a-8c13-4decf97d75ce/fast-keyword-string-searc.aspx
VMR9 is able to "decode" only uncompressed formats. Actually there is
nothing to decompress here.
VMR9 will accept various RGB and YUV formats.
> 3- Where is the actual decompression taking place? In VMR9 or some
> filter that it is attached to? I'd have thought the latter and yet the
> IAMVideoAccelerator interface is on VMR9.
In order to decode Windows Media file, you will need a WM ASF Reader filter
and WMVideo Decoder DMO filter conncted to it. Of course, if there is also
an audio stream, you will need a WMAudio Decoder DMO too. So, the reader
delivers compressed frames/audio samples and decoder does the decoding.
Try using GraphEdit and you will see what's happening where in DShow graph.
> 1- Do I need to first of all to add a decode filter to
> the graph and connect it to VMR9 before I can find out
> what media types VMR9 can decode?
Yes. However, it should be safe for your application to call
IPin::EnumMediaTypes() or
IAMVideoAccelerator::GetVideoAcceleratorGUIDs() or
IAMVideoAccelerator::GetUncompFormatsSupported() directly.
> 2- Do I even need VMR9 to access DXVA anyway? My
> understanding is that DXVA is only exposed through
> IAMVideoAccelerator and that itself is only exposed
> through either the Overlay Mixer or VMR7 or VMR9.
DXVA1.0 is only exposed through the DS stock video
renderers, while DXVA2.0 (Vista+) is also available as a
separate and directly accessible API.
> 3- Where is the actual decompression taking place? In
> VMR9 or some filter that it is attached to? I'd have
> thought the latter and yet the IAMVideoAccelerator
> interface is on VMR9.
The video renderer doesn't decompress anything. If you use
DXVA, the video renderer simply acts as pass-through in
between the connected decoder and the DXVA-enabled video
driver. During the DXVA connection setup, the decoder and
the driver will negotiate how to divide the workload in
between them: decoding is a multistep pipeline and DXVA
allows drivers to only perform the latest steps, leaving the
task of performing the intial ones to the decoder. How many
steps belong to each other depends on the level of DXVA
acceleration that is negotiated. The decoder must also
extract the data from the media samples and prepare the
buffers to send to the driver.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
"Alessandro Angeli" wrote:
> .
>