ROCm / rocDecode

rocDecode is a high performance video decode SDK for AMD hardware
https://rocm.docs.amd.com/projects/rocDecode/en/latest
Other
10 stars 14 forks source link

[Issue]: videoDecodeBatch - Multi-version FFMPEG support missing #401

Closed kiritigowda closed 1 month ago

kiritigowda commented 1 month ago

Problem Description

6: Run Build Command(s):/usr/bin/gmake -f Makefile && [ 33%] Building CXX object CMakeFiles/videodecodebatch.dir/videodecodebatch.cpp.o
6: In file included from /opt/rocm/share/rocdecode/samples/videoDecodeBatch/videodecodebatch.cpp:42:
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:542:9: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?
6:   542 |         AVBSFContext *av_bsf_ctx_ = nullptr;
6:       |         ^~~~~~~~~~~~
6:       |         AVIOContext
6: /usr/include/ffmpeg/libavformat/avio.h:319:3: note: 'AVIOContext' declared here
6:   319 | } AVIOContext;
6:       |   ^
6: In file included from /opt/rocm/share/rocdecode/samples/videoDecodeBatch/videodecodebatch.cpp:42:
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:143:17: error: use of undeclared identifier 'av_bsf_free'
6:   143 |                 av_bsf_free(&av_bsf_ctx_);
6:       |                 ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:173:21: error: use of undeclared identifier 'av_bsf_send_packet'; did you mean 'avcodec_send_packet'?
6:   173 |                 if (av_bsf_send_packet(av_bsf_ctx_, packet_) != 0) {
6:       |                     ^~~~~~~~~~~~~~~~~~
6:       |                     avcodec_send_packet

target_compile_definitions -- missing

FFMPEG`

ffmpeg -version
ffmpeg version 5.1.5 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 11 (GCC)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 ' --extra-cflags=' -I/usr/include/rav1e' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libjxl --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-vulkan --enable-libshaderc --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzvbi --enable-lv2 --enable-avfilter --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-lto --enable-libmfx --enable-runtime-cpudetect
libavutil      57. 28.100 / 57. 28.100
libavcodec     59. 37.100 / 59. 37.100
libavformat    59. 27.100 / 59. 27.100
libavdevice    59.  7.100 / 59.  7.100
libavfilter     8. 44.100 /  8. 44.100
libswscale      6.  7.100 /  6.  7.100
libswresample   4.  7.100 /  4.  7.100
libpostproc    56.  6.100 / 56.  6.100

Operating System

RHEL 9

CPU

ALL

GPU

AMD Instinct MI300X

ROCm Version

ROCm 6.1.0

ROCm Component

No response

Steps to Reproduce

No response

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

kiritigowda commented 1 month ago

Without fix

ctest -R video_decodeBatch -VV
UpdateCTestConfiguration  from :/home/taccuser/kiriti/test/DartConfiguration.tcl
Parse Config file:/home/taccuser/kiriti/test/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/taccuser/kiriti/test/DartConfiguration.tcl
Parse Config file:/home/taccuser/kiriti/test/DartConfiguration.tcl
Test project /home/taccuser/kiriti/test
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 6
    Start 6: video_decodeBatch

6: Test command: /usr/local/bin/ctest "--build-and-test" "/opt/rocm/share/rocdecode/samples/videoDecodeBatch" "/home/taccuser/kiriti/test/videoDecodeBatch" "--build-generator" "Unix Makefiles" "--test-command" "videodecodebatch" "-i" "/opt/rocm/share/rocdecode/video/" "-t" "2"
6: Working Directory: /home/taccuser/kiriti/test
6: Test timeout computed to be: 1500
6: Internal cmake changing into directory: /home/taccuser/kiriti/test/videoDecodeBatch
6: ======== CMake output     ======
6: The C compiler identification is GNU 11.4.1
6: The CXX compiler identification is GNU 11.4.1
6: Detecting C compiler ABI info
6: Detecting C compiler ABI info - done
6: Check for working C compiler: /usr/bin/cc - skipped
6: Detecting C compile features
6: Detecting C compile features - done
6: Detecting CXX compiler ABI info
6: Detecting CXX compiler ABI info - done
6: Check for working CXX compiler: /usr/bin/c++ - skipped
6: Detecting CXX compile features
6: Detecting CXX compile features - done
6: Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3") 
6: Checking for module 'libavcodec'
6:   Found libavcodec, version 59.37.100
6: Checking for module 'libavformat'
6:   Found libavformat, version 59.27.100
6: Checking for module 'libavutil'
6:   Found libavutil, version 57.28.100
6: -- Using FFMPEG -- 
6:  Libraries:/usr/lib64/libavcodec.so;/usr/lib64/libavformat.so;/usr/lib64/libavutil.so 
6:  Includes:/usr/include/ffmpeg
6: -- videodecodebatch: Using rocDecode -- 
6:  Libraries:/opt/rocm/lib/librocdecode.so 
6:  Includes:/opt/rocm/include/rocdecode
6: Found Threads: TRUE  
6: Configuring done
6: Generating done
6: Build files have been written to: /home/taccuser/kiriti/test/videoDecodeBatch
6: ======== End CMake output ======
6: Change Dir: /home/taccuser/kiriti/test/videoDecodeBatch
6: 
6: Run Clean Command:/usr/bin/gmake -f Makefile clean
6: 
6: Run Build Command(s):/usr/bin/gmake -f Makefile && [ 33%] Building CXX object CMakeFiles/videodecodebatch.dir/videodecodebatch.cpp.o
6: In file included from /opt/rocm/share/rocdecode/samples/videoDecodeBatch/videodecodebatch.cpp:42:
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:544:9: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?
6:   544 |         AVBSFContext *av_bsf_ctx_ = nullptr;
6:       |         ^~~~~~~~~~~~
6:       |         AVIOContext
6: /usr/include/ffmpeg/libavformat/avio.h:319:3: note: 'AVIOContext' declared here
6:   319 | } AVIOContext;
6:       |   ^
6: In file included from /opt/rocm/share/rocdecode/samples/videoDecodeBatch/videodecodebatch.cpp:42:
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:145:17: error: use of undeclared identifier 'av_bsf_free'
6:   145 |                 av_bsf_free(&av_bsf_ctx_);
6:       |                 ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:175:21: error: use of undeclared identifier 'av_bsf_send_packet'; did you mean 'avcodec_send_packet'?
6:   175 |                 if (av_bsf_send_packet(av_bsf_ctx_, packet_) != 0) {
6:       |                     ^~~~~~~~~~~~~~~~~~
6:       |                     avcodec_send_packet
6: /usr/include/ffmpeg/libavcodec/avcodec.h:2595:5: note: 'avcodec_send_packet' declared here
6:  2595 | int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
6:       |     ^
6: In file included from /opt/rocm/share/rocdecode/samples/videoDecodeBatch/videodecodebatch.cpp:42:
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:175:40: error: cannot initialize a parameter of type 'AVCodecContext *' with an lvalue of type 'AVIOContext *'
6:   175 |                 if (av_bsf_send_packet(av_bsf_ctx_, packet_) != 0) {
6:       |                                        ^~~~~~~~~~~
6: /usr/include/ffmpeg/libavcodec/avcodec.h:2595:41: note: passing argument to parameter 'avctx' here
6:  2595 | int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
6:       |                                         ^
6: In file included from /opt/rocm/share/rocdecode/samples/videoDecodeBatch/videodecodebatch.cpp:42:
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:179:21: error: use of undeclared identifier 'av_bsf_receive_packet'; did you mean 'avcodec_receive_packet'?
6:   179 |                 if (av_bsf_receive_packet(av_bsf_ctx_, packet_filtered_) != 0) {
6:       |                     ^~~~~~~~~~~~~~~~~~~~~
6:       |                     avcodec_receive_packet
6: /usr/include/ffmpeg/libavcodec/avcodec.h:2671:5: note: 'avcodec_receive_packet' declared here
6:  2671 | int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
6:       |     ^
6: In file included from /opt/rocm/share/rocdecode/samples/videoDecodeBatch/videodecodebatch.cpp:42:
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:179:43: error: cannot initialize a parameter of type 'AVCodecContext *' with an lvalue of type 'AVIOContext *'
6:   179 |                 if (av_bsf_receive_packet(av_bsf_ctx_, packet_filtered_) != 0) {
6:       |                                           ^~~~~~~~~~~
6: /usr/include/ffmpeg/libavcodec/avcodec.h:2671:44: note: passing argument to parameter 'avctx' here
6:  2671 | int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt);
6:       |                                            ^
6: In file included from /opt/rocm/share/rocdecode/samples/videoDecodeBatch/videodecodebatch.cpp:42:
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:465:23: error: unknown type name 'AVBitStreamFilter'
6:   465 |                 const AVBitStreamFilter *bsf = av_bsf_get_by_name("h264_mp4toannexb");
6:       |                       ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:465:48: error: use of undeclared identifier 'av_bsf_get_by_name'
6:   465 |                 const AVBitStreamFilter *bsf = av_bsf_get_by_name("h264_mp4toannexb");
6:       |                                                ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:476:54: error: no member named 'par_in' in 'AVIOContext'
6:   476 |                 avcodec_parameters_copy(av_bsf_ctx_->par_in, av_fmt_input_ctx_->streams[av_stream_]->codecpar);
6:       |                                         ~~~~~~~~~~~  ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:477:21: error: use of undeclared identifier 'av_bsf_init'
6:   477 |                 if (av_bsf_init(av_bsf_ctx_) < 0) {
6:       |                     ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:483:23: error: unknown type name 'AVBitStreamFilter'
6:   483 |                 const AVBitStreamFilter *bsf = av_bsf_get_by_name("hevc_mp4toannexb");
6:       |                       ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:483:48: error: use of undeclared identifier 'av_bsf_get_by_name'
6:   483 |                 const AVBitStreamFilter *bsf = av_bsf_get_by_name("hevc_mp4toannexb");
6:       |                                                ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:494:54: error: no member named 'par_in' in 'AVIOContext'
6:   494 |                 avcodec_parameters_copy(av_bsf_ctx_->par_in, av_fmt_input_ctx_->streams[av_stream_]->codecpar);
6:       |                                         ~~~~~~~~~~~  ^
6: /opt/rocm/share/rocdecode/samples/videoDecodeBatch/../../utils/video_demuxer.h:495:21: error: use of undeclared identifier 'av_bsf_init'
6:   495 |                 if (av_bsf_init(av_bsf_ctx_) < 0) {
6:       |                     ^
6: 14 errors generated.
6: gmake[2]: *** [CMakeFiles/videodecodebatch.dir/build.make:76: CMakeFiles/videodecodebatch.dir/videodecodebatch.cpp.o] Error 1
6: gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/videodecodebatch.dir/all] Error 2
6: gmake: *** [Makefile:91: all] Error 2
6: 
1/1 Test #6: video_decodeBatch ................***Failed    1.41 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   1.41 sec

The following tests FAILED:
      6 - video_decodeBatch (Failed)
Errors while running CTest
Output from these tests are in: /home/taccuser/kiriti/test/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
LakshmiKumar23 commented 1 month ago

@kiritigowda @AryanSalmanpour I think there is still multiple versions of FFMPEG on that docker. The struct and functions are available in release 5.1 here

kiritigowda commented 1 month ago

With fix

[taccuser@rocm-iv-10 test]$ ctest -R video_decodeBatch -VV
UpdateCTestConfiguration  from :/home/taccuser/kiriti/test/DartConfiguration.tcl
Parse Config file:/home/taccuser/kiriti/test/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/taccuser/kiriti/test/DartConfiguration.tcl
Parse Config file:/home/taccuser/kiriti/test/DartConfiguration.tcl
Test project /home/taccuser/kiriti/test
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 6
    Start 6: video_decodeBatch

6: Test command: /usr/local/bin/ctest "--build-and-test" "/opt/rocm/share/rocdecode/samples/videoDecodeBatch" "/home/taccuser/kiriti/test/videoDecodeBatch" "--build-generator" "Unix Makefiles" "--test-command" "videodecodebatch" "-i" "/opt/rocm/share/rocdecode/video/" "-t" "2"
6: Working Directory: /home/taccuser/kiriti/test
6: Test timeout computed to be: 1500
6: Internal cmake changing into directory: /home/taccuser/kiriti/test/videoDecodeBatch
6: ======== CMake output     ======
6: The C compiler identification is GNU 11.4.1
6: The CXX compiler identification is GNU 11.4.1
6: Detecting C compiler ABI info
6: Detecting C compiler ABI info - done
6: Check for working C compiler: /usr/bin/cc - skipped
6: Detecting C compile features
6: Detecting C compile features - done
6: Detecting CXX compiler ABI info
6: Detecting CXX compiler ABI info - done
6: Check for working CXX compiler: /usr/bin/c++ - skipped
6: Detecting CXX compile features
6: Detecting CXX compile features - done
6: Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3") 
6: Checking for module 'libavcodec'
6:   Found libavcodec, version 59.37.100
6: Checking for module 'libavformat'
6:   Found libavformat, version 59.27.100
6: Checking for module 'libavutil'
6:   Found libavutil, version 57.28.100
6: -- Using FFMPEG -- 
6:  Libraries:/usr/lib64/libavcodec.so;/usr/lib64/libavformat.so;/usr/lib64/libavutil.so 
6:  Includes:/usr/include/ffmpeg
6: -- videodecodebatch: Using rocDecode -- 
6:  Libraries:/opt/rocm/lib/librocdecode.so 
6:  Includes:/opt/rocm/include/rocdecode
6: Found Threads: TRUE  
6: Configuring done
6: Generating done
6: Build files have been written to: /home/taccuser/kiriti/test/videoDecodeBatch
6: ======== End CMake output ======
6: Change Dir: /home/taccuser/kiriti/test/videoDecodeBatch
6: 
6: Run Clean Command:/usr/bin/gmake -f Makefile clean
6: 
6: Run Build Command(s):/usr/bin/gmake -f Makefile && [ 33%] Building CXX object CMakeFiles/videodecodebatch.dir/videodecodebatch.cpp.o
6: [ 66%] Building CXX object CMakeFiles/videodecodebatch.dir/opt/rocm/share/rocdecode/utils/rocvideodecode/roc_video_dec.cpp.o
6: [100%] Linking CXX executable videodecodebatch
6: [100%] Built target videodecodebatch
6: 
6: Running test command: "/home/taccuser/kiriti/test/videoDecodeBatch/videodecodebatch" "-i" "/opt/rocm/share/rocdecode/video/" "-t" "2"
6: info: Number of threads: 2
6: info: decoding AMD_driving_virtual_20-H265.mp4 using GPU device 0 - Radeon RX 7900 XTX[gfx1100] on PCI bus 0a:00.0
6: info: decoding AMD_driving_virtual_20-H264.mp4 using GPU device 0 - Radeon RX 7900 XTX[gfx1100] on PCI bus 0a:00.0
6: Input Video Information
6:  Codec        : AVC/H.264
6:  Frame rate   : 60000/2002 = 29.97 fps
6:  Sequence     : Progressive
6:  Coded size   : [2048, 1024]
6:  Display area : [0, 0, 2048, 1024]
6:  Chroma       : YUV 420
6:  Bit depth    : 8
6: Video Decoding Params:
6:  Num Surfaces : 7
6:  Crop         : [0, 0, 2048, 1024]
6:  Resize       : 2048x1024
6: 
6: Input Video Information
6:  Codec        : H.265/HEVC
6:  Frame rate   : 30000/1001 = 29.97 fps
6:  Sequence     : Progressive
6:  Coded size   : [2048, 1024]
6:  Display area : [0, 0, 2048, 1024]
6:  Chroma       : YUV 420
6:  Bit depth    : 8
6: Video Decoding Params:
6:  Num Surfaces : 7
6:  Crop         : [0, 0, 2048, 1024]
6:  Resize       : 2048x1024
6: 
6: info: decoding AMD_driving_virtual_20-AV1.mp4 using GPU device 0 - Radeon RX 7900 XTX[gfx1100] on PCI bus 0a:00.0
6: Input Video Information
6:  Codec        : AV1
6:  Sequence     : Progressive
6:  Coded size   : [2048, 1024]
6:  Display area : [0, 0, 2048, 1024]
6:  Chroma       : YUV 420
6:  Bit depth    : 8
6: Video Decoding Params:
6:  Num Surfaces : 12
6:  Crop         : [0, 0, 2048, 1024]
6:  Resize       : 2048x1024
6: 
6: info: Total frame decoded: 1803
6: info: avg decoding time per frame: 0.495857 ms
6: info: avg FPS: 2016.71
6: 
1/1 Test #6: video_decodeBatch ................   Passed    4.35 sec

The following tests passed:
    video_decodeBatch

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   4.35 sec
kiritigowda commented 1 month ago

@kiritigowda @AryanSalmanpour I think there is still multiple versions of FFMPEG on that docker. The struct and functions are available in release 5.1 here

This is due to missing #402

kiritigowda commented 1 month ago

Issue to be fixed with #402

@AryanSalmanpour ctest -- video_decodeBatch will be a fail in version 6.2.0 for any OS using FFMPEG 5.X. Need this fix cherry-picked for 6.2.1

kiritigowda commented 1 month ago

Merged to TOT Develop