Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ffmpeg-qsv] add string api support #651

Merged
merged 7 commits into from
Aug 23, 2024
Merged

Conversation

FocusLuo
Copy link
Contributor

@FocusLuo FocusLuo commented May 14, 2024

add string api support for ffmpeg-qsv
1, enable on DG2 fistly
2, the patch comments will update later after some times reviews done

@FocusLuo FocusLuo force-pushed the ffmpeg-stringapi branch from 30eb750 to f852a4a Compare June 3, 2024 07:01
@FocusLuo FocusLuo requested review from uartie and Bin-CI June 3, 2024 07:01
@FocusLuo FocusLuo changed the title [Draft][ffmpeg-qsv] add string api support [ffmpeg-qsv] add string api support Jun 3, 2024
@FocusLuo
Copy link
Contributor Author

FocusLuo commented Jun 3, 2024

ffmpeg-qsv cmdline:
./smoke run test/ffmpeg-qsv/encode --pl DG2 --context=sanity --device=/dev/dri/renderD129 -vv
./smoke run test/ffmpeg-qsv/encode --pl DG2 --context=sanity --device=/dev/dri/renderD129 --stringapi 0 -vv
./smoke run test/ffmpeg-qsv/encode --pl DG2 --context=sanity --device=/dev/dri/renderD129 --stringapi 1 -vv
./smoke run test/ffmpeg-qsv/encode --pl DG2 --context=sanity --device=/dev/dri/renderD129 --stringapi 2 -vv
stringapi = 0 and others, will use traditional ffmpeg encode cmdline option
stringapi = 1, will use string api ffmpeg encode cmdline option
stringapi = 2, random to use traditional or string api ffmpeg encode cmdline option

@FocusLuo FocusLuo requested a review from xhaihao June 3, 2024 07:12
@Bin-CI
Copy link
Contributor

Bin-CI commented Jun 3, 2024

@mengker33 please help to review

Copy link
Contributor

@uartie uartie left a comment

Choose a reason for hiding this comment

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

This is not a full review...

I'm not convinced we should modify the base qsv encoder. It seems we could introduce a new qsv string encoder class or something. Let me think about the design some more and we can discuss later...

lib/ffmpeg/qsv/encoder.py Outdated Show resolved Hide resolved
.slashrc Outdated Show resolved Hide resolved
lib/caps/DG2/info Outdated Show resolved Hide resolved
@FocusLuo
Copy link
Contributor Author

FocusLuo commented Jun 4, 2024

This is not a full review...

I'm not convinced we should modify the base qsv encoder. It seems we could introduce a new qsv string encoder class or something. Let me think about the design some more and we can discuss later...

Cool! thanks a lot Artie on supporting this. BTW, gst-vpl will also support stringAPI in Q3, so please also think about gst-vpl part.

@uartie
Copy link
Contributor

uartie commented Jun 5, 2024

This is not a full review...
I'm not convinced we should modify the base qsv encoder. It seems we could introduce a new qsv string encoder class or something. Let me think about the design some more and we can discuss later...

Cool! thanks a lot Artie on supporting this. BTW, gst-vpl will also support stringAPI in Q3, so please also think about gst-vpl part.

@FocusLuo please have a look at uartie@714ea06
It uses multi-inheritance techniques to "mixin" the string api encoder overrides. It isn't a complete solution, yet, so I figure you may be able to finish some of the details (e.g. additional property overrides, mappings, etc.).
Note, at the end of the file is a quick example of usage. We may need to think about if we want to reuse existing user config spec variants or add a new variant. If we reuse, then we will essentially double the encode cases, which may not be desirable.

@FocusLuo
Copy link
Contributor Author

This is not a full review...
I'm not convinced we should modify the base qsv encoder. It seems we could introduce a new qsv string encoder class or something. Let me think about the design some more and we can discuss later...

Cool! thanks a lot Artie on supporting this. BTW, gst-vpl will also support stringAPI in Q3, so please also think about gst-vpl part.

@FocusLuo please have a look at uartie@714ea06 It uses multi-inheritance techniques to "mixin" the string api encoder overrides. It isn't a complete solution, yet, so I figure you may be able to finish some of the details (e.g. additional property overrides, mappings, etc.). Note, at the end of the file is a quick example of usage. We may need to think about if we want to reuse existing user config spec variants or add a new variant. If we reuse, then we will essentially double the encode cases, which may not be desirable.

Thanks Artie, by re-used the uartie@714ea06,
re-submitted the patches, how do you think?

  1. only enabled the avc/hevc/av1 encode firstly
  2. there will be some failed cases on cbr and vbr, especailly for hevc and av1 encode, how to control the CI regression test report? do you have any idea?

@FocusLuo
Copy link
Contributor Author

New test cases cmdlines: for avc/hevc/av1 encode
./smoke run test/ffmpeg-qsv/encode/hevc.py:cqp.test_strapi --pl ADL --context=sanity --device=/dev/dri/renderD128 -vv
./smoke run test/ffmpeg-qsv/encode/hevc.py:cqp_lp.test_strapi --pl DG2--context=sanity --device=/dev/dri/renderD129 -vv
./smoke run test/ffmpeg-qsv/encode/hevc.py:cbr.test_strapi --pl ADL --context=sanity --device=/dev/dri/renderD128 -vv
./smoke run test/ffmpeg-qsv/encode/hevc.py:cbr_lp.test_strapi --pl DG2--context=sanity --device=/dev/dri/renderD129 -vv
./smoke run test/ffmpeg-qsv/encode/hevc.py:vbr.test_strapi --pl ADL --context=sanity --device=/dev/dri/renderD128 -vv
./smoke run test/ffmpeg-qsv/encode/hevc.py:vbr_lp.test_strapi --pl DG2--context=sanity --device=/dev/dri/renderD129 -vv

lib/platform.py Outdated Show resolved Hide resolved
lib/mfx/api.py Outdated Show resolved Hide resolved
lib/mfx/api.py Show resolved Hide resolved
lib/mfx/api.py Outdated Show resolved Hide resolved
lib/mfx/api.py Show resolved Hide resolved
lib/mfx/api.py Show resolved Hide resolved
test/ffmpeg-qsv/encode/av1.py Outdated Show resolved Hide resolved
@uartie
Copy link
Contributor

uartie commented Jun 18, 2024

This is not a full review...
I'm not convinced we should modify the base qsv encoder. It seems we could introduce a new qsv string encoder class or something. Let me think about the design some more and we can discuss later...

Cool! thanks a lot Artie on supporting this. BTW, gst-vpl will also support stringAPI in Q3, so please also think about gst-vpl part.

@FocusLuo please have a look at uartie@714ea06 It uses multi-inheritance techniques to "mixin" the string api encoder overrides. It isn't a complete solution, yet, so I figure you may be able to finish some of the details (e.g. additional property overrides, mappings, etc.). Note, at the end of the file is a quick example of usage. We may need to think about if we want to reuse existing user config spec variants or add a new variant. If we reuse, then we will essentially double the encode cases, which may not be desirable.

Thanks Artie, by re-used the uartie@714ea06, re-submitted the patches, how do you think?

  1. only enabled the avc/hevc/av1 encode firstly
  2. there will be some failed cases on cbr and vbr, especailly for hevc and av1 encode, how to control the CI regression test report? do you have any idea?

My patch wasn't a completed solution... please finish the TODO's and other details (missing some property definitions and mappings).

@FocusLuo FocusLuo force-pushed the ffmpeg-stringapi branch from 975b372 to 1670f32 Compare July 1, 2024 01:52
@FocusLuo
Copy link
Contributor Author

FocusLuo commented Jul 1, 2024

@uartie do you think it is good to merge this PR firstly? then let me to submit another PR for your other comments such as

  1. move map_level/rate/profile to the enum class as lookup;
  2. to use new gen functions for string (there will have avc gen cqp/cbr/vbr, hevc gen functions, av1 gen functions and also have lp and non-lp),
    and definitely you will have other comments input in future.
    how do you think? this will help me decrease my local update/comment maintain effort, and also help wenqing to do some issue testing on finding issue among different platforms or integrate into CI issue firstly
    thanks
    Focus

@uartie
Copy link
Contributor

uartie commented Jul 10, 2024

@uartie do you think it is good to merge this PR firstly? then let me to submit another PR for your other comments such as

  1. move map_level/rate/profile to the enum class as lookup;
  2. to use new gen functions for string (there will have avc gen cqp/cbr/vbr, hevc gen functions, av1 gen functions and also have lp and non-lp),
    and definitely you will have other comments input in future.
    how do you think? this will help me decrease my local update/comment maintain effort, and also help wenqing to do some issue testing on finding issue among different platforms or integrate into CI issue firstly
    thanks
    Focus

The issue I have is it automatically doubles the cases as mentioned in #651 (comment). For full tests, it would add an additional 2-3 hours depending on platform.

@FocusLuo
Copy link
Contributor Author

@uartie do you think it is good to merge this PR firstly? then let me to submit another PR for your other comments such as

  1. move map_level/rate/profile to the enum class as lookup;
  2. to use new gen functions for string (there will have avc gen cqp/cbr/vbr, hevc gen functions, av1 gen functions and also have lp and non-lp),
    and definitely you will have other comments input in future.
    how do you think? this will help me decrease my local update/comment maintain effort, and also help wenqing to do some issue testing on finding issue among different platforms or integrate into CI issue firstly
    thanks
    Focus

The issue I have is it automatically doubles the cases as mentioned in #651 (comment). For full tests, it would add an additional 2-3 hours depending on platform.

Ok, will submit new patch to use dedicated gen functions for string api, thanks

lib/parameters_strapi.py Outdated Show resolved Hide resolved
lib/parameters_strapi.py Outdated Show resolved Hide resolved
lib/parameters_strapi.py Outdated Show resolved Hide resolved
lib/parameters_strapi.py Outdated Show resolved Hide resolved
lib/parameters_strapi.py Outdated Show resolved Hide resolved
lib/ffmpeg/util.py Outdated Show resolved Hide resolved
.slashrc Outdated Show resolved Hide resolved
Copy link
Contributor

@Bin-CI Bin-CI left a comment

Choose a reason for hiding this comment

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

Almost good to me, just one comment

lib/ffmpeg/util.py Show resolved Hide resolved
Bin-CI
Bin-CI previously approved these changes Aug 9, 2024
Copy link
Contributor

@Bin-CI Bin-CI left a comment

Choose a reason for hiding this comment

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

LGTM, look's like we can merge have_ffmpeg_filter with have_ffmpeg_encoder, have_ffmpeg_decoder and have_ffmpeg_filter_options have_ffmpeg_encode_options in feature

def _have_ffmpeg_key(name, key):
  result = try_call(f"{exe2os('ffmpeg')} -hide_banner -{key}s | awk '{{print $2}}' | grep -w {name}")
  return result, name

@FocusLuo
Copy link
Contributor Author

@uartie is the latest new update version good to you?

lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
Copy link
Contributor

@uartie uartie left a comment

Choose a reason for hiding this comment

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

Don't use is True.

The variants should always be a list before hitting the loop. This will cut down on the diff noise.

lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
lib/parameters.py Outdated Show resolved Hide resolved
Copy link
Contributor

@uartie uartie left a comment

Choose a reason for hiding this comment

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

Please avoid making extra changes that weren't suggested and we could be good to go. Almost there ;)

lib/parameters.py Outdated Show resolved Hide resolved
lib/mfx/api.py Outdated Show resolved Hide resolved
Copy link
Contributor

@uartie uartie left a comment

Choose a reason for hiding this comment

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

The end result looks good to me.

However, please squash your commits into a few logically organized commits, as appropriate. There should not be any intermediate commits that only address the reviews. Those changes should be applied to the originals.

@FocusLuo
Copy link
Contributor Author

The end result looks good to me.

However, please squash your commits into a few logically organized commits, as appropriate. There should not be any intermediate commits that only address the reviews. Those changes should be applied to the originals.

thanks Artie,
updated

Copy link
Contributor

@uartie uartie left a comment

Choose a reason for hiding this comment

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

Ugh... sorry I didn't notice these before...

lib/mfx/api.py Outdated Show resolved Hide resolved
lib/mfx/api.py Outdated Show resolved Hide resolved
@uartie uartie merged commit a726fb1 into intel:master Aug 23, 2024
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants