Skip to main content

 none
Decoding at lower resolution than full frame RRS feed

  • Question

  • Hi all,

    Read this : https://docs.microsoft.com/en-us/windows/win32/medfound/video-quality-management

    Did this :

        // Create a new topology.
        IMFTopology *topology = nullptr;
        HRESULT hr = MFCreateTopology(&topology);

           // EXPERIMENTAL: Not currently doing anything.
           HRESULT hr = topology->SetUINT32(MF_TOPOLOGY_STATIC_PLAYBACK_OPTIMIZATIONS, TRUE);
           hr = MFSetAttributeSize(topology, MF_TOPOLOGY_PLAYBACK_MAX_DIMS, 64, 64);
     
          // Rest of topology build code ...


    In something derived from the MFPlayer app sample code.

    At stated, video continues to render full resolution. looking for ways I can reduce load on low end systems.

    Input welcome if it's possible to achieve this.

    Cheers,
    Steve

    Monday, October 28, 2019 4:25 PM

All replies

  • Found this too : https://stackoverflow.com/questions/26840659/how-to-change-media-foundation-transform-output-framevideo-size

    ... which resizes *after* a full frame decode. Not what I want.

    looking to reduce the number of pixels being decoded as a way of trading quality for performance on low end systems.

    Also, didn't mention above, but this has to work with our custom EVR as we don't display direct to the screen.

    Can make any mods required there if necessary.
    Tuesday, October 29, 2019 6:09 PM
  • ... and this :

    https://stackoverflow.com/questions/27981951/media-foundation-how-to-change-frame-size-in-mft-media-foundation-transform

    Working sample code running in MFPlayer would be awesome.

    To change output size that's actually decoded, not shunk afterwards. Ideally dynamically on a per frame basis.

    ... and yes, you can do that even with sparse keyframes if the hardware's up to it or you feed it back a working buffer scaled to the size it's expecting to partially decode/amend into.


    Tuesday, October 29, 2019 6:13 PM
  • It might be possible to decode JPEG into smaller resolution trading speed/resources for quality. This would require capable decoder, which stock JPEG decoder is not.

    It does not work with more sophisticated encodings like H.264: you'd decode full frame and then scale down as needed. You typically want this with GPU assistance so that it is more efficient.

    No you won't be able to scale down before decoding completes, except the case of JPEG and most likely a third party (or yours) decoder MFT.


    http://alax.info/blog/tag/directshow

    Tuesday, October 29, 2019 10:49 PM
  • There's no inherent issue with dynamic scaling that I've figured out thus far.

    We're most
    ly talking video here but the same principle can apply to static images.

    Hunch is a hardware cyc
    le will be required to implement / deliver.
    Wednesday, October 30, 2019 9:27 AM
  • > does not work with more sophisticated encodings like H.264: you'd decode full frame and then scale down as needed

    Apparently does.

    From reference EVR, in CreateOptimalVideoType

    MFSetAttributeSize(optimal_type, MF_MT_FRAME_SIZE,
    optimal_type->SetBlob(MF_MT_GEOMETRIC_APERTURE,
    optimal_type->SetBlob(MF_MT_PAN_SCAN_APERTURE,
    optimal_type->SetBlob(MF_MT_MINIMUM_DISPLAY_APERTURE,

    Seems to force a lower resolution sample decode, hopefully with a performance win - still experimenting.

    That's better than nothing, but not dynamic. Wanting to change on a frame by frame basis.

    Current hardware might not be able to do that & even if it can, Media Foundation doesn't currently support afaik.

    So wish list. From what I know, its technically feasible & a significant performance win as we don't need hi rez decode for something that's tiny on the screen.

    Example of use case - video lounge where content varies in size on the screen & hence required resolution on a frame by frame basis as the user moves around.

    Video lounge - multiple videos playing. Don't need full resolution decode when they're small on the screen.

    Wednesday, October 30, 2019 9:42 AM
  • Apparently does.

    No it does not. I see no proof it does from the written above. EVR's "optimal" media type has nothing to do with what you look for.


    http://alax.info/blog/tag/directshow


    Wednesday, October 30, 2019 10:32 AM
  • The EVR renders to a texture surface whose dimensions I can now control. What happens under the hood, I have no idea & could be device dependant.

    A start, in that the decoder *could* decode to a smaller image size direct, whether they do or not, I don't know. Performance may indicate the likely configuration. Testing that up next.

    In any event, this isn't dynamic, so not the whole way there.

    ... but a start :)
    Wednesday, October 30, 2019 12:16 PM
  • As you suspected, Roman, no performance benefit. It is likely decoding full frame & downscaling under the hood, current nvidia driver, anyhow.

    So we need this doing right, p
    lease Microsoft so we can tune performance according to screen area occupied on a per-frame basis & according to machine capabilities & quantity of videos played simultaneously.

    Thanks :)
    Thursday, November 14, 2019 1:02 PM