Skip to content

CAP_MFX: surface pool with timeout, more parameters#17228

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
mshabunin:mfx-surface-pool-34
May 12, 2020
Merged

CAP_MFX: surface pool with timeout, more parameters#17228
opencv-pushbot merged 1 commit intoopencv:3.4from
mshabunin:mfx-surface-pool-34

Conversation

@mshabunin
Copy link
Copy Markdown
Contributor

Added environment variables to control MFX videoio backend:

  • OPENCV_VIDEOIO_MFX_IMPL - preferred implementation, number, see mfxIMPL documentation
  • OPENCV_VIDEOIO_MFX_POOL_TIMEOUT - surface pool wait timeout, seconds, default value is 1
  • OPENCV_VIDEOIO_MFX_EXTRA_SURFACE_NUM - extra surfaces in surface pool, number, default value is 0
  • OPENCV_VIDEOIO_MFX_BITRATE_DIVISOR - bitrate calculation divisor, number, default value is 500, bitrate = pixel_num * fps/ divisor
  • OPENCV_VIDEOIO_MFX_WRITER_TIMEOUT - encoder timeout, seconds, default value is 1

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under OpenCV (BSD) License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@mshabunin mshabunin force-pushed the mfx-surface-pool-34 branch 3 times, most recently from 55172a8 to dd9cedf Compare May 8, 2020 16:06
using namespace std;
using namespace cv;

static size_t IMPL = utils::getConfigurationParameterSizeT("OPENCV_VIDEOIO_MFX_IMPL", MFX_IMPL_AUTO_ANY);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets avoid exploding of global static initialization tables.
Use lazy on-demand initialization instead. See static const String getBuildExtraOptions() from ocl.cpp

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I repeat scheme with initialized flag or use simple static initialization like shown below?

size_t getValue()
{
    static const size_t value = initValue();
    return value;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this is enough (sample code prints "overloaded" message):

size_t getValue()
{
    static const size_t value = utils::getConfigurationParameterSizeT("OPENCV_VIDEOIO_MFX_IMPL", MFX_IMPL_AUTO_ANY);
    return value;
}

@mshabunin mshabunin force-pushed the mfx-surface-pool-34 branch from dd9cedf to f309318 Compare May 12, 2020 15:44
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Thank you 👍

@opencv-pushbot opencv-pushbot merged commit 6856cc7 into opencv:3.4 May 12, 2020
@alalek alalek mentioned this pull request May 12, 2020
@mshabunin mshabunin deleted the mfx-surface-pool-34 branch July 14, 2020 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants