[BUG] GetClosestScaleForResolution & requestUpsideDown

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline
User avatar

Chris Hocking

  • Posts: 682
  • Joined: Wed Aug 22, 2012 4:23 am
  • Location: Melbourne, Australia

[BUG] GetClosestScaleForResolution & requestUpsideDown

PostThu Sep 29, 2022 6:33 am

Is anyone able to provide some basic example code on how to use the
Code: Select all
IBlackmagicRawClipResolutions
Interface?

Thanks in advance!
Last edited by Chris Hocking on Fri Sep 30, 2022 5:45 am, edited 2 times in total.
Offline
User avatar

Chris Hocking

  • Posts: 682
  • Joined: Wed Aug 22, 2012 4:23 am
  • Location: Melbourne, Australia

Re: How to use IBlackmagicRawClipResolutions?

PostThu Sep 29, 2022 9:15 am

All good, worked it out, thanks to this thread.

Code: Select all
IBlackmagicRawClipResolutions *clipResolutions;
clip->QueryInterface(IID_IBlackmagicRawClipResolutions, (void**)&clipResolutions);


This should probably be added to the SDK Documentation?
Offline
User avatar

Chris Hocking

  • Posts: 682
  • Joined: Wed Aug 22, 2012 4:23 am
  • Location: Melbourne, Australia

Re: [SOLVED] How to use IBlackmagicRawClipResolutions

PostThu Sep 29, 2022 9:57 am

Interestingly though, that when I feed it really low width and height (i.e. 112x63), the `requestUpsideDown` isn't properly respected? For example, I expect:

Code: Select all
bool requestUpsideDown = true;
clipResolutions->GetClosestScaleForResolution(destinationWidth, destinationHeight, requestUpsideDown, &resolutionScale);


...to always return `blackmagicRawResolutionScaleFullUpsideDown`, `blackmagicRawResolutionScaleHalfUpsideDown`, `blackmagicRawResolutionScaleQuarterUpsideDown` or `blackmagicRawResolutionScaleEighthUpsideDown` - because I've set `requestUpsideDown` to `true`?

Am I misunderstanding something?
Offline
User avatar

Chris Hocking

  • Posts: 682
  • Joined: Wed Aug 22, 2012 4:23 am
  • Location: Melbourne, Australia

Re: [BUG] GetClosestScaleForResolution & requestUpsideDown

PostFri Sep 30, 2022 5:48 am

I've modified the ProcessClipMetal sample, to explain my issue.

Specifically:

Code: Select all
IBlackmagicRawClipResolutions *clipResolutions;
clip->QueryInterface(IID_IBlackmagicRawClipResolutions, (void**)&clipResolutions);

uint32_t decodeQuality;

//
// NOTE: Feeding `GetClosestScaleForResolution` with 1920x1080 and `requestUpsideDown` as `true` gives upside down image,
//       however, feeding it 112x63 and `requestUpsideDown` as `true` gives a right-side-up image?!?
//
uint32_t destinationWidth   = 112; //1920;
uint32_t destinationHeight  = 63;  //1080;
bool requestUpsideDown      = true;

clipResolutions->GetClosestScaleForResolution(destinationWidth, destinationHeight, requestUpsideDown, &decodeQuality);


Here's the full code:

https://gist.github.com/latenitefilms/2 ... 54a5544128

Feeding it 1920x1080 and requestUpsideDown as true gives an upside down image, which is correct.

Feeding it 112x63 and requestUpsideDown as true gives a right-side-up image, which I believe is incorrect.

Am I missing something CaptainHook? Is this a bug or a misunderstanding on my part?
Offline
User avatar

antoine

  • Posts: 466
  • Joined: Sat Nov 24, 2018 2:20 am
  • Real Name: Antoine Dornstetter

Re: [BUG] GetClosestScaleForResolution & requestUpsideDown

PostFri Sep 30, 2022 10:30 am

Alternatively, you could maybe use GetClosestResolutionForScale to look for the best scale possible
BRAW Studio FREE and Premium for Adobe Premiere Pro and After Effects
Offline
User avatar

Chris Hocking

  • Posts: 682
  • Joined: Wed Aug 22, 2012 4:23 am
  • Location: Melbourne, Australia

Re: [BUG] GetClosestScaleForResolution & requestUpsideDown

PostFri Sep 30, 2022 10:47 am

Thanks for the fast reply Antoine!

Dumb question... If I did use GetClosestScaleForResolution, what do I then do with the resolutionWidthPixels, and resolutionHeightPixels? I couldn't see any API for setting a specific output resolution?
Offline
User avatar

antoine

  • Posts: 466
  • Joined: Sat Nov 24, 2018 2:20 am
  • Real Name: Antoine Dornstetter

Re: [BUG] GetClosestScaleForResolution & requestUpsideDown

PostMon Oct 03, 2022 7:38 am

If you use GetClosestScaleForResolution you get Scale in output from Resolution in input (what you initially wanted). With GetClosestResolutionForScale you would do the opposite, you would iterate all the scales (in input) until you get a resolution (in output) that would fit best (or least worst :D ) you for what you're trying to do
BRAW Studio FREE and Premium for Adobe Premiere Pro and After Effects
Offline
User avatar

Chris Hocking

  • Posts: 682
  • Joined: Wed Aug 22, 2012 4:23 am
  • Location: Melbourne, Australia

Re: [BUG] GetClosestScaleForResolution & requestUpsideDown

PostMon Oct 03, 2022 7:43 am

Thanks Antoine!

It sounds like this is a bug - will hopefully get confirmation tomorrow.
Offline
User avatar

Chris Hocking

  • Posts: 682
  • Joined: Wed Aug 22, 2012 4:23 am
  • Location: Melbourne, Australia

Re: [BUG] GetClosestScaleForResolution & requestUpsideDown

PostWed Oct 05, 2022 1:13 am

For anyone playing along at home... Blackmagic has confirmed this is a bug, and will be hopefully addressed in the future. Thanks team!

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests