{"id":1371,"date":"2012-08-04T11:14:20","date_gmt":"2012-08-04T09:14:20","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=1371"},"modified":"2012-08-04T11:14:29","modified_gmt":"2012-08-04T09:14:29","slug":"using-vista-vieo-resizer-dsp-in-directshow-via-dmo-wrapper-filter","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/1371","title":{"rendered":"Using Vista Video Resizer DSP in DirectShow, via DMO Wrapper Filter"},"content":{"rendered":"<p>Windows Vista introduced helpful video and audio <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/ff819501(v=vs.85).aspx\">Digital Signal Processors (DSPs)<\/a> in DMO form-factor, which however do not work smoothly with <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/dd375519%28v=vs.85%29.aspx\">DMO Wrapper Filter<\/a> and thus cannot be directly used in DirectShow.<\/p>\n<p>There perhaps was no intent in first place to extend DirectShow functionality with these new components, and no effort was put into providing this mode of operation, however as long as the new classes are <code>DMOs<\/code>, it is still possible to tune them up to work in DirectShow pipeline.<\/p>\n<p>This sample code\/application provides a code snippet on how <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/ff819491%28v=vs.85%29.aspx\">Video Resizer DSP<\/a> can be used in DirectShow. There were earlier some discussions on <a href=\"http:\/\/social.msdn.microsoft.com\/Forums\/sr\/windowsdirectshowdevelopment\/thread\/d4cb265a-bd99-4d9e-a679-e1ea2bd0ffb9\">MSDN Forums<\/a> and this complements the guidelines with code.<\/p>\n<p>The idea is the following:<\/p>\n<ul>\n<li><code>CoCreateInstance<\/code> the <code>DSP<\/code> as <code>DMO<\/code> and add it to <code>DMO Wrapper Filter<\/code><\/li>\n<li>Use <code>IWMResizerProps::SetFullCropRegion<\/code> to initialize the <code>DSP<\/code><\/li>\n<li>Connect input pin<\/li>\n<li>Set output type via <code>IMediaObject::SetOutputType<\/code><\/li>\n<li><code>IGraphBuilder::ConnectDirect<\/code> output pin<\/li>\n<\/ul>\n<p>The sample application takes a video file (note that for the brevity of the sample, not all files will be supported, there is an assumption that files are decoded into <code>VIDEOINFOHEADER<\/code> media type, and we limit color spaces to 32-bit RGB only to avoid problems on the way in this tiny sample).<\/p>\n<p>The application takes file path (I recommend <code>.WMV<\/code>) creates DirectShow pipeline, adds Sample Grabber filter to force color space to be 32-bit RGB, adds resizer and sets it up to double video height, but not width, and plays the video.<\/p>\n<p>The application&#8217;s filter graph looks like this:<\/p>\n<p><a href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/08\/Image001.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1372\" title=\"Resizer DSP Filter Graph\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/08\/Image001-800x242.png\" alt=\"\" width=\"620\" height=\"187\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/08\/Image001-800x242.png 800w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/08\/Image001-320x96.png 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/08\/Image001.png 985w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><\/p>\n<p>And the video window is stretched twice in height:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1373\" title=\"Video Window\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/08\/Image002.png\" alt=\"\" width=\"334\" height=\"516\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/08\/Image002.png 334w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2012\/08\/Image002-207x320.png 207w\" sizes=\"auto, (max-width: 334px) 100vw, 334px\" \/><\/p>\n<p>A binary [<a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/Utilities\/ConfigureVideoResizerDmo\/Release\/ConfigureVideoResizerDmo.exe\">Win32<\/a>] and Visual C++ .NET 2010 source code [<a href=\"https:\/\/www.alax.info\/trac\/public\/browser\/trunk\/Utilities\/ConfigureVideoResizerDmo\/\">Trac<\/a>, <a href=\"https:\/\/www.alax.info\/svn\/public\/trunk\/Utilities\/ConfigureVideoResizerDmo\/\">Subversion<\/a>] are available from SVN; the important part goes <a href=\"https:\/\/www.alax.info\/trac\/public\/browser\/trunk\/Utilities\/ConfigureVideoResizerDmo\/ConfigureVideoResizerDmo.cpp#L115\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows Vista introduced helpful video and audio Digital Signal Processors (DSPs) in DMO form-factor, which however do not work smoothly with DMO Wrapper Filter and thus cannot be directly used in DirectShow. There perhaps was no intent in first place to extend DirectShow functionality with these new components, and no effort was put into providing&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/1371\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,13],"tags":[78,83,422,423,486],"class_list":["post-1371","post","type-post","status-publish","format-standard","hentry","category-atl","category-source","tag-directshow","tag-dmo","tag-dsp","tag-resizer","tag-video"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=1371"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/1371\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=1371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=1371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=1371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}