intel / libvpl

Intel® Video Processing Library (Intel® VPL) API, dispatcher, and examples
https://intel.github.io/libvpl/
MIT License
262 stars 80 forks source link

[hello-decode] Redundant pixels would be written into file #66

Closed Austin-Hu closed 1 year ago

Austin-Hu commented 1 year ago

After applying the change to decode H.264 bitstream, which was encoded with 16 pixels aligned in width and height:

diff --git a/examples/hello/hello-decode/src/hello-decode.cpp b/examples/hello/hello-decode/src/hello-decode.cpp
index 6f555ee..e649294 100644
--- a/examples/hello/hello-decode/src/hello-decode.cpp
+++ b/examples/hello/hello-decode/src/hello-decode.cpp
@@ -82,7 +82,7 @@ int main(int argc, char *argv[]) {
     cfg[1] = MFXCreateConfig(loader);
     VERIFY(NULL != cfg[1], "MFXCreateConfig failed")
     cfgVal[1].Type     = MFX_VARIANT_TYPE_U32;
-    cfgVal[1].Data.U32 = MFX_CODEC_HEVC;
+    cfgVal[1].Data.U32 = MFX_CODEC_AVC;
     sts                = MFXSetConfigFilterProperty(
         cfg[1],
         (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID",
@@ -113,13 +113,13 @@ int main(int argc, char *argv[]) {
     bitstream.MaxLength = BITSTREAM_BUFFER_SIZE;
     bitstream.Data      = (mfxU8 *)calloc(bitstream.MaxLength, sizeof(mfxU8));
     VERIFY(bitstream.Data, "Not able to allocate input buffer");
-    bitstream.CodecId = MFX_CODEC_HEVC;
+    bitstream.CodecId = MFX_CODEC_AVC;

     // Pre-parse input stream
     sts = ReadEncodedStream(bitstream, source);
     VERIFY(MFX_ERR_NONE == sts, "Error reading bitstream\n");

-    decodeParams.mfx.CodecId = MFX_CODEC_HEVC;
+    decodeParams.mfx.CodecId = MFX_CODEC_AVC;
     decodeParams.IOPattern   = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
     sts                      = MFXVideoDECODE_DecodeHeader(session, &bitstream, &decodeParams);
     VERIFY(MFX_ERR_NONE == sts, "Error decoding header\n");

with the command:

hello-decode -hw -i client_bitstream.h264

Then I'd get the decoded YUV data like:

image

In order to show it correctly, I had to adjust its size with aligned one, but with redundant 8 lines displayed at the bottom:

image

mav-intel commented 1 year ago

Fixed in 7e7fd619e3589baaaa6c8c5a25b930ff24ef05eb