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

[Question]: AMF MJPEG decoder returns NV12 with green bar #310

Open
toruishihara opened this issue Apr 20, 2022 · 1 comment
Open

[Question]: AMF MJPEG decoder returns NV12 with green bar #310

toruishihara opened this issue Apr 20, 2022 · 1 comment
Labels

Comments

@toruishihara
Copy link

I use AMF MJPEG MFT for decoding MJPEG data from USB camera.
I set input frame 320x240, output is 320x256 NV12, because vertical alignment is 32.
Output NV12 frame has 16 extra lines. But Y and UV value of these line are all zero. That add high luminance green bar on bottom.

I can copy frame to CPU and remove 16 line and back to GPU, but it takes time. Because GPU-CPU copy is slow.
It become slower than software MJPEG decoder.

I like to know one of these option is possible.

  • Remove extra 16 lines on 320x240 case on AMF decoder
  • Change extra 16 lines color to black.

MFT DLL location on my Windows10 PC.
C:\Windows\System32\DriverStore\FileRepository\u0361313.inf_amd64_07132764fbaf152d\B361334\amf-mft-mjpeg-decoder64.dll

@MikhailAMD
Copy link
Collaborator

This is not unique for MJPEG but rather common for all HW decoders: they need aligned output textures in video memory. Some codecs need 16 pixels, some like MJPEG - 32 pixels. Note, that it could be horizontal and/or vertical alignment. The common practice is that HW decoder returns cropping area and it is up to the calling app to deal with it (MF_MT_MINIMUM_DISPLAY_APERTURE for MFTs). Adding GPU copy for solely removing borders in the HW decoder is inefficient. As you said, using CPU to remove lines is also inefficient. The usual solution is, that the component after the decoder should recognize cropping and deal with it: if it is color converter, it should remove borders. But implementation depends on your pipeline. The next component could be Video Processor MFT (from MSFT) or your custom code. If the latter, you can run D3D11 compute shader to remove lines or combine the removal with other processing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants