Browse Source

Update gstreamer and ffmpeg source code

Clement 1 year ago
parent
commit
ac5b0692d1

+ 37 - 0
multimedia/ChangeLog

@@ -0,0 +1,37 @@
+
+
+code_mm_20230113_based_VF2_515_v2.8.0:
+
+- update mm_libs(wave511, wave420l, codaj12, omx-il), ffmpeg, gstreamer version to VF2_515_v2.8.0
+- Fix VPU that low probability of segment fault when decoding finish
+- add the futex patch to the JPU and wave420l
+
+------
+
+code_mm_20221226_based_VF2_515_v2.5.0:
+
+- update mm_libs(wave511, wave420l, codaj12, omx-il), ffmpeg, gstreamer version from VF2_515_v2.4.2 to VF2_515_v2.5.0
+
+------
+
+code_mm_20221118_based_VF2_515_v2.4.2:
+
+- update mm_libs(wave511, wave420l, codaj12, omx-il), ffmpeg, gstreamer version from VF2_515_v2.4.1 to VF2_515_v2.4.2
+- Fix the futex issue using windsome's patch
+- support build and run omx unit test: video_dec_test, video_enc_test, mjpeg_dec_test
+- Support build and run the vendor test example
+- Add gst-libav package to support avdec_*** plugin to support soft video/audio codec
+
+------
+
+code_mm_20221118_based_VF2_515_v2.4.1:
+
+- update mm_libs(wave511, wave420l, codaj12, omx-il), ffmpeg, gstreamer version to VF2_515_v2.4.1
+- Fix the futex issue using trylock patch
+
+
+
+
+
+
+

+ 58 - 29
multimedia/README.md

@@ -30,35 +30,37 @@
 Before build, the debian need to install the below packages:
 
 ```
-# apt install build-essential libchromaprint-dev libaom-dev liblilv-dev libiec61883-dev libass-dev \
-    libbluray-dev libbs2b-dev libcodec2-dev libdav1d-dev flite1-dev libgme-dev \
-    libgsm1-dev libmp3lame-dev libmysofa-dev libopenjp2-7-dev libopenmpt-dev \
-    libopus-dev librabbitmq-dev libssl-dev librubberband-dev libsamplerate0-dev \
-    libshine-dev libsnappy-dev libsoxr-dev libsoxr-lsr0 libspeex-dev libssh-4 \
-    libssh-dev libv4l-0 libv4l-dev libtheora-dev libtwolame-dev libvidstab-dev \
-    libvpx-dev libwebp-dev libwebpdemux2 libx264-dev libx265-dev libxvidcore-dev \
-    libzimg-dev libzvbi-dev libopenal-dev ocl-icd-opencl-dev opencl-c-headers \
-    opencl-clhpp-headers javascript-common libjs-jquery libpocketsphinx-dev \
-    libsphinxbase-dev libgnutls28-dev libsrt-openssl-dev libsrt-gnutls-dev \
-    libsrt1.4-openssl libcaca-dev libdc1394-dev \
-    libjack-dev libcdio-dev libcdparanoia-dev libcdio-paranoia-dev librsvg2-dev libzmq3-dev \
-    meson ninja-build flex bison \
-    libudev-dev libgudev-1.0-dev \
-    libx11-dev libxext-dev libxv-dev libxfixes-dev libxdamage-dev \
-    libasound2-dev libflac-dev
+# apt install build-essential flex bison  git make cmake autoconf automake \
+        libtool pkg-config ninja-build meson bash-completion net-tools \
+        tmux vim tree strace gdb file htop nfs-common psmisc lm-sensors \
+        v4l-utils pciutils usbutils
+
+# apt install libchromaprint-dev libaom-dev liblilv-dev libiec61883-dev libass-dev \
+        libbluray-dev libbs2b-dev libcodec2-dev libdav1d-dev flite1-dev libgme-dev \
+        libgsm1-dev libmp3lame-dev libmysofa-dev libopenjp2-7-dev libopenmpt-dev \
+        libopus-dev librabbitmq-dev libssl-dev librubberband-dev libsamplerate0-dev \
+        libshine-dev libsnappy-dev libsoxr-dev libsoxr-lsr0 libspeex-dev libssh-4 \
+        libssh-dev libv4l-0 libv4l-dev libtheora-dev libtwolame-dev libvidstab-dev \
+        libvpx-dev libwebp-dev libwebpdemux2 libx264-dev libx265-dev libxvidcore-dev \
+        libzimg-dev libzvbi-dev libopenal-dev ocl-icd-opencl-dev opencl-c-headers \
+        opencl-clhpp-headers javascript-common libjs-jquery libpocketsphinx-dev \
+        libsphinxbase-dev libgnutls28-dev libsrt-openssl-dev libcaca-dev libdc1394-dev \
+        libjack-dev libcdio-dev libcdparanoia-dev libcdio-paranoia-dev librsvg2-dev libzmq3-dev \
+        libasound2-dev libflac-dev libudev-dev libgudev-1.0-dev libjpeg-dev libdrm-dev \
+        libx11-dev libxext-dev libxv-dev libxfixes-dev libxdamage-dev libpulse-dev liba52-0.7.4-dev
  
  Note: Need to remove the gstreamer installed from upstream repo
  # apt purge libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 gstreamer1.0-plugins-base
  
 ```
 
-The `mm_libs-JH7110_MM_vxxxx.tar.xz` could be generated by the below, first git clone the usdk code
+The `mm_libs-VF2_515_vx.x.x.tar.xz` could be generated by the below, first git clone the usdk code
 
 ```
 # git clone git@gitlab.starfivetech.com:sbc/visionfive.git
 # git checkout VF2_515_vx.x.x    # checkout to the tag VF2_515_vx.x.x
 # cd visionfive/soft_3rdpart
-# tar cvJf mm_libs-VF2_515_vx.x.x.tar.xz --exclude=codaj12/stream --exclude=codaj12/yuv --exclude=wave420l/code/yuv --exclude=wave511/media --exclude=wave511/code/stream --exclude=wave511/code/yuv codaj12 omx-il wave420l wave511
+# tar cvJf mm_libs-VF2_515_vx.x.x.tar.xz --exclude=codaj12/yuv --exclude=wave420l/code/yuv --exclude=wave511/media --exclude=wave511/code/yuv codaj12 omx-il wave420l wave511
 ```
 
 ### How to Build:
@@ -107,24 +109,20 @@ Building_GStreamer="enable"
 
 ### How to Run:
 
-Note the wave511 driver vdec.ko, wave420l driver venc.ko, codaj12 driver jpu.ko not built in this. These *.ko driver should match the corresponding linux kernel image. They can be built under the usdk path `work/buildroot_initramfs_sysroot/root/wave511/` ,`work/buildroot_initramfs_sysroot/root/wave420l/`, `work/buildroot_initramfs_sysroot/root/codaj12/`
+Now the wave511 driver vdec.ko, wave420l driver venc.ko, codaj12 driver jpu.ko have been loaded when booting up. 
 
-Then copy these *.ko driver to `target/root/wave511`,  `target/root/wave420l`, `target/root/codaj12`
+So just run the below:
 
-Then run the below:
-
-for ffmpeg:
+Run ffmpeg:
 
 ```
 # source run_env.sh
-# target/usr/bin/ffmpeg  -vcodec h264_omx -i Sintel_720_10s_10MB.mp4 -pix_fmt yuv420p 720p_i420.yuv
-# ffplay  -vcodec h264_omx -i Sintel_720_10s_10MB.mp4
-Note: ffplay had problem, will fix it asap
-
-
+# $CURDIR/target/usr/bin/ffmpeg -v verbose -vcodec h264_omx -i Sintel_720_10s_10MB.mp4 -pix_fmt yuv420p 720p_i420.yuv
+# $CURDIR/target/usr/bin/ffplay -v verbose -vcodec h264_omx -i Sintel_720_10s_10MB.mp4
+# $CURDIR/target/usr/bin/ffplay -v verbose -vcodec hevc_omx -i /test1_720P.h265
 ```
 
-or for gstreamer:
+Run gstreamer:
 
 ```
 # source run_env.sh
@@ -136,3 +134,34 @@ or for gstreamer:
 # gst-launch-1.0 filesrc location=file_example_MP4_640_3MG.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! xvimagesink
 ```
 
+Run omx unit test:
+
+```
+# source run_env.sh
+# $CURDIR/target/usr/bin/video_dec_test -i /1080P.h265 -o 1080P_nv12.yuv -f nv12
+# $CURDIR/target/usr/bin/video_dec_test -i /test1_720P.h265 -o test1_720P_nv12.yuv -f nv12
+# $CURDIR/target/usr/bin/video_enc_test -i /1080p_30fps_HEVC_nv12.yuv -o 1080p_HEVC_NV12_omx.h265 -s h265 -w 1920 -h 1080 -b 5120000 -c nv12
+# $CURDIR/target/usr/bin/mjpeg_dec_test -i /test1_1080P_mjpeg.mp4 -o test1_1080P_mjpeg.yuv -f i420
+```
+
+### APPENDIX I: Build wave511 wave420l codaj12 vendor test example
+
+the package support to build wave511 wave420l codaj12 vendor test example
+
+```
+cd wave511/wave511/
+./build_for_vdec.sh
+# the vendor test example will be installed to vdec_driver/
+
+cd wave420l/code/
+./build.sh
+# the vendor test example will be installed to venc_driver/
+
+cd codaj12
+./build_for_riscv.sh
+# the vendor test example will be installed to jpu_driver/
+
+```
+
+
+

+ 65 - 30
multimedia/build.sh

@@ -9,11 +9,19 @@
 set -e
 CURDIR=$(cd `dirname $0`; pwd)
 cd $CURDIR
-rm -rf $CURDIR/target/
 
 Building_FFmpeg="enable"
 Building_GStreamer="enable"
 
+if [ "$1" = "clean" ]; then
+    rm -rf wave511/ wave420l/ codaj12/ omx-il/ ffmpeg-4.4.1/ gstreamer-1.18.5/ \
+        gst-plugins-base-1.18.5/ gst-plugins-good-1.18.5/ gst-plugins-ugly-1.18.5/ \
+        gst-plugins-bad-1.18.5/ gst-omx-1.18.5/ gst-libav-1.18.5/
+    exit
+fi
+
+rm -rf $CURDIR/target/
+
 function apply_patch {
     local i
     local srcdir="${1}"
@@ -30,33 +38,46 @@ function apply_patch {
 }
 
 ##################################################################
-## Install third-party packages depended by ffmpeg and gstreamer
-if [ 1 != 1 ] ; then
-    apt install build-essential libchromaprint-dev libaom-dev liblilv-dev libiec61883-dev libass-dev \
-    libbluray-dev libbs2b-dev libcodec2-dev libdav1d-dev flite1-dev libgme-dev \
-    libgsm1-dev libmp3lame-dev libmysofa-dev libopenjp2-7-dev libopenmpt-dev \
-    libopus-dev librabbitmq-dev libssl-dev librubberband-dev libsamplerate0-dev \
-    libshine-dev libsnappy-dev libsoxr-dev libsoxr-lsr0 libspeex-dev libssh-4 \
-    libssh-dev libv4l-0 libv4l-dev libtheora-dev libtwolame-dev libvidstab-dev \
-    libvpx-dev libwebp-dev libwebpdemux2 libx264-dev libx265-dev libxvidcore-dev \
-    libzimg-dev libzvbi-dev libopenal-dev ocl-icd-opencl-dev opencl-c-headers \
-    opencl-clhpp-headers javascript-common libjs-jquery libpocketsphinx-dev \
-    libsphinxbase-dev libgnutls28-dev libsrt-openssl-dev libsrt-gnutls-dev \
-    libsrt1.4-openssl libcaca-dev libdc1394-dev \
-    libjack-dev libcdio-dev libcdparanoia-dev libcdio-paranoia-dev librsvg2-dev libzmq3-dev \
-    meson ninja-build flex bison \
-    libudev-dev libgudev-1.0-dev \
-    libx11-dev libxext-dev libxv-dev libxfixes-dev libxdamage-dev \
-    libasound2-dev libflac-dev
-    
-    apt purge libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 gstreamer1.0-plugins-base
-    sync
+## Install packages depended by ffmpeg and gstreamer for ubuntu18.04
+if false; then
+    apt install build-essential flex bison  git make cmake autoconf automake \
+        libtool pkg-config ninja-build meson bash-completion net-tools \
+        tmux vim tree strace gdb file htop nfs-common psmisc lm-sensors \
+        v4l-utils pciutils usbutils
+
+    # disable libchromaprint-dev for it depend on the newest ffmpeg 5.1.2
+    apt install  libaom-dev liblilv-dev libiec61883-dev libass-dev \
+        libbluray-dev libbs2b-dev libcodec2-dev libdav1d-dev flite1-dev libgme-dev \
+        libgsm1-dev libmp3lame-dev libmysofa-dev libopenjp2-7-dev libopenmpt-dev \
+        libopus-dev librabbitmq-dev libssl-dev librubberband-dev libsamplerate0-dev \
+        libshine-dev libsnappy-dev libsoxr-dev libsoxr-lsr0 libspeex-dev libssh-4 \
+        libssh-dev libv4l-0 libv4l-dev libtheora-dev libtwolame-dev libvidstab-dev \
+        libvpx-dev libwebp-dev libwebpdemux2 libx264-dev libx265-dev libxvidcore-dev \
+        libzimg-dev libzvbi-dev libopenal-dev ocl-icd-opencl-dev opencl-c-headers \
+        opencl-clhpp-headers javascript-common libjs-jquery libpocketsphinx-dev \
+        libsphinxbase-dev libgnutls28-dev libsrt-openssl-dev libcaca-dev libdc1394-dev \
+        libjack-dev libcdio-dev libcdparanoia-dev libcdio-paranoia-dev librsvg2-dev libzmq3-dev \
+        libasound2-dev libflac-dev libudev-dev libgudev-1.0-dev libjpeg-dev libdrm-dev \
+        libx11-dev libxext-dev libxv-dev libxfixes-dev libxdamage-dev libpulse-dev liba52-0.7.4-dev
+
+    # apt purge libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 gstreamer1.0-plugins-base
+
+    # correct the sdl2.pc lib path from /opt/SDL/build/out to /usr/local
+    sed -i "s/\/opt\/SDL\/build\/out/\/usr\/local/g" /usr/local/lib/pkgconfig/sdl2.pc
+
+    # if install qt, correct the qt lib path, or add -Dqt5=disabled for gst-plugin-good
+    find /usr/local/lib/pkgconfig/ -name "Qt5*.pc" | xargs -t -i sed -i "s/\/qt-everywhere-src-5.15.2\/build\/out/\/usr\/local/g" {}
+
+    find /usr/local/lib/ -name "*.la" | xargs -t -i sed -i "s/\/qt-everywhere-src-5.15.2\/build\/out/\/usr\/local/g" {}
+
+    # fix ffmpeg and gstreamer
+    find /usr/local/lib/pkgconfig/ -name "*.pc" | xargs -t -i sed -i "s/\/code_mm\/target\/usr/\/usr\/local/g" {}
 fi
 
 ##################################################################
 ## Extract and patch for wave511, wave420l, codaj12, omx-il
 echo "Extract and patch wave511, wave420l, codaj12, omx-il..."
-mm_libs_TARBALL=mm_libs-VF2_515_v2.4.1.tar.xz
+mm_libs_TARBALL=mm_libs-VF2_515_v2.8.0.tar.xz
 mm_libs_PATCH=patch/mm_libs
 rm -rf wave511/ wave420l/ codaj12/ omx-il/
 tar xf ${mm_libs_TARBALL}
@@ -65,8 +86,8 @@ sync
 apply_patch ./ $mm_libs_PATCH
 
 ## Extract and patch for gstreamer and ffmpeg
-GST_TARBALLS=("gstreamer-1.18.5" "gst-plugins-base-1.18.5" "gst-plugins-good-1.18.5" "gst-plugins-bad-1.18.5" "gst-plugins-ugly-1.18.5" "gst-omx-1.18.5")
-GST_PATCHS=("gstreamer1/gstreamer1" "gstreamer1/gst1-plugins-base" "gstreamer1/gst1-plugins-good" "gstreamer1/gst1-plugins-bad" "gstreamer1/gst1-plugins-ugly" "gstreamer1/sf-gst-omx")
+GST_TARBALLS=("gstreamer-1.18.5" "gst-plugins-base-1.18.5" "gst-plugins-good-1.18.5" "gst-plugins-bad-1.18.5" "gst-plugins-ugly-1.18.5" "gst-libav-1.18.5" "gst-omx-1.18.5")
+GST_PATCHS=("gstreamer1/gstreamer1" "gstreamer1/gst1-plugins-base" "gstreamer1/gst1-plugins-good" "gstreamer1/gst1-plugins-bad" "gstreamer1/gst1-plugins-ugly" "gstreamer1/gst-libav" "gstreamer1/sf-gst-omx")
 PKG_TARBALLS=(${GST_TARBALLS[@]} "ffmpeg-4.4.1")
 PKG_PATCHS=(${GST_PATCHS[@]} "ffmpeg")
 PKG_NUMS=${#PKG_TARBALLS[@]}
@@ -124,11 +145,14 @@ popd
 
 ##################################################################
 ## build ffmpeg
+## to support gdb: --enable-debug --disable-stripping --disable-optimizations
+## remove --enable-chromaprint for the new glibc issue, libchromaprint depend on the libavcodec.so.59
 if [ "$Building_FFmpeg"X = "enable"X ]; then
     ffmpeg_src=ffmpeg-4.4.1
-    pushd $ffmpeg_src
+    mkdir -p $ffmpeg_src/build
+    pushd $ffmpeg_src/build
     echo "Building ffmpeg start..."
-    ./configure --prefix=$CURDIR/target/usr  --arch="riscv64" --target-os="linux" \
+    ../configure --prefix=$CURDIR/target/usr  --arch="riscv64" --target-os="linux" \
     --enable-gpl --disable-stripping --disable-static --enable-shared --enable-avfilter \
     --disable-version3 --enable-logging --disable-extra-warnings --enable-avdevice \
     --enable-avcodec --enable-avformat --enable-network --disable-gray --enable-swscale-alpha \
@@ -145,7 +169,7 @@ if [ "$Building_FFmpeg"X = "enable"X ]; then
     --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid \
     --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-openal \
     --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg \
-    --enable-libdc1394 --enable-libdrm  --enable-chromaprint --enable-libx264 \
+    --enable-libdc1394 --enable-libdrm   --enable-libx264 \
     --disable-frei0r --disable-gnutls --disable-ladspa --disable-libiec61883 --enable-omx \
     --extra-ldflags="-L$CURDIR/target/usr/lib" \
     --extra-cflags="-I$CURDIR/target/usr/include/omx-il" \
@@ -162,7 +186,8 @@ fi
 if [ "$Building_GStreamer"X = "enable"X ]; then
     GST_CONFIGS=("--libdir=lib --default-library=shared --buildtype=release -Dstrip=true" \
         "--libdir=lib --default-library=shared --buildtype=release -Dstrip=true" \
-        "--libdir=lib --default-library=shared --buildtype=release -Dstrip=true -Dcairo=disabled" \
+        "--libdir=lib --default-library=shared --buildtype=release -Dstrip=true -Dcairo=disabled -Dqt5=disabled" \
+        "--libdir=lib --default-library=shared --buildtype=release -Dstrip=true" \
         "--libdir=lib --default-library=shared --buildtype=release -Dstrip=true" \
         "--libdir=lib --default-library=shared --buildtype=release -Dstrip=true" \
         "--libdir=lib --default-library=shared --buildtype=release -Dstrip=true -Dtarget=stf -Dheader_path=$CURDIR/target/usr/include/omx-il" \
@@ -173,7 +198,6 @@ if [ "$Building_GStreamer"X = "enable"X ]; then
     for ((i=0; i<$GST_NUMS; i++)); do
         gst_src=${GST_TARBALLS[$i]}
         gst_config=${GST_CONFIGS[$i]}
-
         pushd $gst_src
         mkdir -p $gst_src/build
         PKG_CONFIG_PATH=$CURDIR/target/usr/lib/pkgconfig meson --prefix=$CURDIR/target/usr $gst_config $CURDIR/$gst_src $CURDIR/$gst_src/build
@@ -184,3 +208,14 @@ if [ "$Building_GStreamer"X = "enable"X ]; then
     done
     echo "Building GStreamer end..."
 fi
+
+##################################################################
+## build omx-il test. depend ffmpeg
+if [ "$Building_FFmpeg"X = "enable"X ]; then
+    pushd omx-il/
+    echo "Building omx-il test..."
+    make test
+    make install_test
+    sync
+    popd
+fi

+ 34 - 0
multimedia/code_mm.code-workspace

@@ -0,0 +1,34 @@
+{
+	"folders": [
+		{
+			"path": "."
+		},
+    ],
+    "settings": {
+        "files.associations": {
+            "*.mak": "makefile",
+        },
+        "files.exclude1": {
+            "**/build": true,
+            "**/gst*": true,
+            "**/target*": true,
+            "**/*.tar.xz": true,
+            "**/.tmp_versions": true,
+            "**/*.dwo": true,
+            "**/*.ko.cmd": true,
+            "**/*.o": true,
+            "**/*.o.cmd": true,
+            "**/doc": true,
+            "**/nonos": true,
+            "**/venc_driver*": true,
+            "**/coda9": true,
+            "**/output": true,
+            "**/obj": true,
+            "**/ffmpeg": true,
+            "**/stream": true,
+            "**/temp": true,
+            "**/log": true,
+            "**/code/yuv": true
+        }
+    }
+}

BIN
multimedia/gst-libav-1.18.5.tar.xz


BIN
multimedia/mm_libs-VF2_515_v2.4.1.tar.xz


BIN
multimedia/target.tar.xz → multimedia/mm_libs-VF2_515_v2.8.0.tar.xz


+ 63 - 0
multimedia/patch/ffmpeg/0020-FFmpeg-omxdec-modify-the-range-of-width-and-height-o.patch

@@ -0,0 +1,63 @@
+From e29c31f71f4a2cf28142d2440c715a43672b08e8 Mon Sep 17 00:00:00 2001
+From: "arvin.zhu" <arvin.zhu@starfivetech.com>
+Date: Wed, 16 Nov 2022 11:19:47 +0800
+Subject: [PATCH] FFmpeg:omxdec: modify the range of width and height of scale
+
+modify the range of width and height of scale for omx decoder
+
+Signed-off-by: arvin.zhu <arvin.zhu@starfivetech.com>
+---
+ libavcodec/omxdec.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/libavcodec/omxdec.c b/libavcodec/omxdec.c
+index 019db2e..4974833 100755
+--- a/libavcodec/omxdec.c
++++ b/libavcodec/omxdec.c
+@@ -361,7 +361,7 @@ static OMX_ERRORTYPE event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, O
+         }
+         break;
+     case OMX_EventPortSettingsChanged:
+-        av_log(s->avctx, AV_LOG_ERROR, "OMX port %"PRIu32" settings changed\n", (uint32_t) data1);
++        av_log(s->avctx, AV_LOG_VERBOSE, "OMX port %"PRIu32" settings changed\n", (uint32_t) data1);
+         INIT_STRUCT(video_port_params);
+         err = OMX_GetParameter(s->handle, OMX_IndexParamVideoInit, &video_port_params);
+         if(err != OMX_ErrorNone){
+@@ -742,15 +742,23 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
+     if (avctx->codec->id == AV_CODEC_ID_H264 || avctx->codec->id == AV_CODEC_ID_HEVC) {
+         /* Set Scale config setting*/
+         if ((s->scale_width != 0) && ((s->scale_width < avctx->width/8) ||
+-             (s->scale_width > avctx->width) || (s->scale_width % 8 != 0))) {
++             (s->scale_width > avctx->width) || (s->scale_width % 2 != 0))) {
+             av_log(avctx, AV_LOG_ERROR, "scale_width: Invalid scale parameter\n");
+             return AVERROR_INVALIDDATA;
+         }
++        if (s->scale_width == avctx->width/8 && (s->scale_width % 8 != 0)) {
++            av_log(avctx, AV_LOG_ERROR, "When scale_width is width/8, scale_width must be a multiple of 8(ceil 8).\n");
++            return AVERROR_INVALIDDATA;
++        }
+         if ((s->scale_height != 0) && ((s->scale_height < avctx->height/8) ||
+-             (s->scale_height > avctx->height) || (s->scale_height % 8 != 0))) {
++             (s->scale_height > avctx->height) || (s->scale_height % 2 != 0))) {
+             av_log(avctx, AV_LOG_ERROR, "scale_height: Invalid scale parameter\n");
+             return AVERROR_INVALIDDATA;
+         }
++        if (s->scale_height == avctx->height/8 && (s->scale_height % 8 != 0)) {
++            av_log(avctx, AV_LOG_ERROR, "When scale_height is height/8, scale_height must be a multiple of 8(ceil 8).\n");
++            return AVERROR_INVALIDDATA;
++        }
+         out_port_params.format.video.nFrameWidth   = s->scale_width ? s->scale_width : avctx->width;
+         out_port_params.format.video.nFrameHeight  = s->scale_height ? s->scale_height : avctx->height;
+ 
+@@ -1072,7 +1080,7 @@ static int omx_decode_frame(AVCodecContext *avctx, void *data,
+         //     s->first_get_outbuffer = 1;
+ 
+         if(!buffer->nFilledLen){
+-            av_log(avctx, AV_LOG_ERROR, "buffer->nFilledLen %d\n",(int)buffer->nFilledLen);
++            av_log(avctx, AV_LOG_VERBOSE, "buffer->nFilledLen %d\n",(int)buffer->nFilledLen);
+             goto end;
+         }
+ 
+-- 
+2.17.1
+

+ 238 - 0
multimedia/patch/ffmpeg/0021-FFmpeg-omxdec-set-pts-of-avframe-and-fix-some-compil.patch

@@ -0,0 +1,238 @@
+From 888f1780682a6a73b4004bec4d51c450ddaac710 Mon Sep 17 00:00:00 2001
+From: "arvin.zhu" <arvin.zhu@starfivetech.com>
+Date: Wed, 23 Nov 2022 15:08:36 +0800
+Subject: [PATCH] FFmpeg:omxdec: set pts of avframe and fix some compilation
+ warnings
+
+set pts of avframe from video container and fix some compilation warnings
+
+Signed-off-by: arvin.zhu <arvin.zhu@starfivetech.com>
+---
+ libavcodec/omxdec.c | 129 +++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 116 insertions(+), 13 deletions(-)
+
+diff --git a/libavcodec/omxdec.c b/libavcodec/omxdec.c
+index 4974833..1bb08b1 100755
+--- a/libavcodec/omxdec.c
++++ b/libavcodec/omxdec.c
+@@ -96,13 +96,96 @@ typedef struct OMXContext {
+     void (*host_init)(void);
+ } OMXContext;
+ 
+-static const struct {
++typedef struct OMXDecodeQueueNode {
++    int64_t val;
++    struct OMXDecodeQueueNode* next;
++} OMXDecodeQueueNode;
++
++typedef struct OMXDecodeQueue {
++    OMXDecodeQueueNode* head;
++    OMXDecodeQueueNode* tail;
++} OMXDecodeQueue;
++
++static av_cold void OMXDecodeQueueInit(OMXDecodeQueue* pq)
++{
++    assert(pq);
++    pq->head = pq->tail = NULL;
++}
++
++static av_cold void OMXDecodeQueueDestory(OMXDecodeQueue* pq)
++{
++    OMXDecodeQueueNode* cur = pq->head;
++    assert(pq);
++    while (cur)
++    {
++        OMXDecodeQueueNode* next = cur->next;
++        av_free(cur);
++        cur = next;
++    }
++    pq->tail = pq->head = NULL;
++}
++
++static void OMXDecodeQueuePush(OMXDecodeQueue* pq, int64_t x)
++{
++    OMXDecodeQueueNode* newNode = (OMXDecodeQueueNode*)malloc(sizeof(OMXDecodeQueueNode));
++    if (NULL == newNode)
++    {
++        av_log(NULL, AV_LOG_ERROR, "malloc queue error\n");
++        exit(-1);
++    }
++    assert(pq);
++    newNode->val = x;
++    newNode->next = NULL;
++
++    if (pq->tail == NULL)
++    {
++        assert(pq->head == NULL);
++        pq->head = pq->tail = newNode;
++    }
++    else
++    {
++        pq->tail->next = newNode;
++        pq->tail = newNode;
++    }
+ 
++}
++
++static void OMXDecodeQueuePop(OMXDecodeQueue* pq)
++{
++    assert(pq);
++    assert(pq->head && pq->tail);
++    if (pq->head->next == NULL)
++    {
++        av_free(pq->head);
++        pq->head = pq->tail = NULL;
++    }
++    else
++    {
++        OMXDecodeQueueNode* next = pq->head->next;
++        av_free(pq->head);
++        pq->head = next;
++    }
++}
++
++static int OMXDecodeQueueEmpty(OMXDecodeQueue* pq)
++{
++    assert(pq);
++
++    return pq->head == NULL;
++}
++
++static int64_t OMXDecodeQueueFront(OMXDecodeQueue* pq)
++{
++    assert(pq);
++    assert(pq->head);
++
++    return pq->head->val;
++}
++
++static const struct {
+     int color_format;
+     enum AVPixelFormat pix_fmt;
+-
+ } color_formats[] = {
+-
+     { OMX_COLOR_FormatYUV420Planar,                           AV_PIX_FMT_YUV420P },
+     { OMX_COLOR_FormatYUV420SemiPlanar,                       AV_PIX_FMT_NV12    },
+     { OMX_COLOR_FormatYVU420SemiPlanar,                       AV_PIX_FMT_NV21    },
+@@ -286,6 +369,8 @@ typedef struct OMXCodecContext {
+         int h;
+     } crop;
+ 
++    OMXDecodeQueue decode_pts_queue;
++    int decode_flag;
+     int input_zerocopy;
+     int profile;
+     char *pixel_format;     /**< Set by a private option. */
+@@ -491,6 +576,10 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
+     //OMX_VIDEO_PARAM_PORTFORMATTYPE video_port_format = { 0 };
+     //OMX_VIDEO_PARAM_BITRATETYPE vid_param_bitrate = { 0 };
+     OMX_ERRORTYPE err;
++    OMX_CONFIG_SCALEFACTORTYPE ScaleConfig;
++    OMX_CONFIG_MIRRORTYPE MirrorConfig;
++    OMX_CONFIG_ROTATIONTYPE RotatConfig;
++    OMX_CONFIG_RECTTYPE RectConfig;
+     int i;
+     s->version.s.nVersionMajor = 1;
+     s->version.s.nVersionMinor = 1;
+@@ -594,7 +683,6 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
+         /* Set Scale config setting*/
+         if (s->scale_width || s->scale_height) {
+             av_log(avctx, AV_LOG_TRACE, "mjpeg decoder: scaling width: %d scaling height: %d .\n", s->scale_width, s->scale_height);
+-            OMX_CONFIG_SCALEFACTORTYPE ScaleConfig;
+             INIT_STRUCT(ScaleConfig);
+             ScaleConfig.nPortIndex = 1;
+             OMX_GetConfig(s->handle, OMX_IndexConfigCommonScale, &ScaleConfig);
+@@ -665,7 +753,6 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
+                 return AVERROR_INVALIDDATA;
+             }
+             av_log(avctx, AV_LOG_TRACE, "mjpeg decoder: mirror\n");
+-            OMX_CONFIG_MIRRORTYPE MirrorConfig;
+             INIT_STRUCT(MirrorConfig);
+             MirrorConfig.nPortIndex = 1;
+             OMX_GetConfig(s->handle, OMX_IndexConfigCommonMirror, &MirrorConfig);
+@@ -680,7 +767,6 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
+                 return AVERROR_INVALIDDATA;
+             }
+             av_log(avctx, AV_LOG_TRACE, "mjpeg decoder: rotation\n");
+-            OMX_CONFIG_ROTATIONTYPE RotatConfig;
+             INIT_STRUCT(RotatConfig);
+             RotatConfig.nPortIndex = 1;
+             OMX_GetConfig(s->handle, OMX_IndexConfigCommonRotate, &RotatConfig);
+@@ -726,7 +812,6 @@ static av_cold int omx_component_init(AVCodecContext *avctx, const char *role)
+                 return AVERROR_INVALIDDATA;
+             }
+ 
+-            OMX_CONFIG_RECTTYPE RectConfig; 
+             INIT_STRUCT(RectConfig);
+             RectConfig.nPortIndex = 1;
+             OMX_GetConfig(s->handle, OMX_IndexConfigCommonOutputCrop, &RectConfig);
+@@ -869,6 +954,8 @@ static av_cold void cleanup(OMXCodecContext *s)
+         pthread_mutex_destroy(&s->output_mutex);
+         s->mutex_cond_inited = 0;
+     }
++    OMXDecodeQueueDestory(&s->decode_pts_queue);
++    av_freep(&s->decode_pts_queue);
+     av_freep(&s->in_buffer_headers);
+     av_freep(&s->out_buffer_headers);
+     av_freep(&s->free_in_buffers);
+@@ -883,7 +970,10 @@ static av_cold int omx_decode_init(AVCodecContext *avctx)
+     const char *role;
+     //OMX_BUFFERHEADERTYPE *buffer;
+     //OMX_ERRORTYPE err;
++    OMXDecodeQueueInit(&s->decode_pts_queue);
+ 
++    av_log(avctx, AV_LOG_VERBOSE, "avctx->time_base: %d/%d \n", avctx->time_base.num, avctx->time_base.den);
++    av_log(avctx, AV_LOG_VERBOSE, "avctx->framerate: %d/%d \n", avctx->framerate.num, avctx->framerate.den);
+     s->omx_context = omx_init(avctx, s->libname, s->libprefix);
+     if (!s->omx_context)
+         return AVERROR_ENCODER_NOT_FOUND;
+@@ -898,6 +988,7 @@ static av_cold int omx_decode_init(AVCodecContext *avctx)
+     s->avctx = avctx;
+     s->state = OMX_StateLoaded;
+     s->error = OMX_ErrorNone;
++    s->decode_flag = 0;
+ 
+     switch (avctx->codec->id) {
+     case AV_CODEC_ID_MPEG4:
+@@ -990,6 +1081,15 @@ static int omx_decode_frame(AVCodecContext *avctx, void *data,
+     uint8_t *dst[4];
+     int linesize[4];
+ 
++    av_log(avctx, AV_LOG_VERBOSE, "s->decode_flag: %d\n", s->decode_flag);
++    av_log(avctx, AV_LOG_VERBOSE, "avctx->time_base: %d/%d \n", avctx->time_base.num, avctx->time_base.den);
++    av_log(avctx, AV_LOG_VERBOSE, "avctx->pkt_timebase: %d/%d \n", avctx->pkt_timebase.num, avctx->pkt_timebase.den);
++    av_log(avctx, AV_LOG_VERBOSE, "avctx->framerate: %d/%d \n", avctx->framerate.num, avctx->framerate.den);
++    av_log(avctx, AV_LOG_VERBOSE, "avpkt->size: %d avpkt->pts: %ld avpkt->dts: %ld avpkt->duration: %ld\n",
++                                     pkt->size, pkt->pts, pkt->dts, pkt->duration);
++    av_log(avctx, AV_LOG_VERBOSE, "avctx->pts_correction_last_pts: %ld avctx->pts_correction_last_dts: %ld\n",
++                                     avctx->pts_correction_last_pts, avctx->pts_correction_last_dts);
++    OMXDecodeQueuePush(&s->decode_pts_queue, pkt->dts);
+     if (pkt->size) {
+ 
+         //VPU init and fill buffer slow, so empty buf sleep to send before get vpu fill buf.
+@@ -1107,12 +1207,15 @@ static int omx_decode_frame(AVCodecContext *avctx, void *data,
+ 
+         av_image_copy(avframe->data, avframe->linesize, (const uint8_t**)dst, linesize, 
+                             avctx->pix_fmt, avctx->width, avctx->height);
+-
+-        //avframe->pts     = buffer->nTimeStamp;
+-        //avframe->pkt_dts = AV_NOPTS_VALUE;
+-        //avframe->pict_type= AV_PICTURE_TYPE_I;
+-        //avframe->key_frame= 1;
+-
++        if (pkt->pts) {
++            if (OMXDecodeQueueEmpty(&s->decode_pts_queue) != 0){
++                av_log(avctx, AV_LOG_ERROR, "The queue of decode pts is empty.\n");
++                return AVERROR_INVALIDDATA;
++            }
++            avframe->pts = OMXDecodeQueueFront(&s->decode_pts_queue);
++            OMXDecodeQueuePop(&s->decode_pts_queue);
++        }
++        s->decode_flag += 1;
+         *got_packet = 1;
+ 
+         /*
+-- 
+2.17.1
+

+ 66 - 0
multimedia/patch/gstreamer1/sf-gst-omx/0019-Add-Interlaced-mode-judgment.patch

@@ -0,0 +1,66 @@
+Add Interlaced-mode judgment for gstomxvideodec class 
+Fix compiler warnings
+
+Signed-off-by: Leo Lu <leo.lu@starfivetech.com>
+
+diff -purN a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+--- a/omx/gstomxvideodec.c	2022-11-03 17:02:54.601333539 +0800
++++ b/omx/gstomxvideodec.c	2022-11-03 16:06:20.435534119 +0800
+@@ -740,7 +740,7 @@ gst_omx_try_importing_buffer (GstOMXVide
+ #ifdef USE_OMX_TARGET_STARFIVE
+   if ( !gst_is_dmabuf_memory (mem)) {
+     GST_INFO_OBJECT (self,
+-        " %d-th buffer doesn't contain dmabuf, go to out. port->port_def.nBufferSize: %lu",
++        " %d-th buffer doesn't contain dmabuf, go to out. port->port_def.nBufferSize: %u",
+         i, port->port_def.nBufferSize);
+     goto out;
+   } 
+@@ -2795,7 +2795,7 @@ gst_omx_video_dec_set_format (GstVideoDe
+   gboolean needs_disable = FALSE;
+   OMX_PARAM_PORTDEFINITIONTYPE port_def;
+   OMX_U32 framerate_q16 = gst_omx_video_calculate_framerate_q16 (info);
+-
++  static gboolean interlaced_print_flag = FALSE;
+   self = GST_OMX_VIDEO_DEC (decoder);
+   klass = GST_OMX_VIDEO_DEC_GET_CLASS (decoder);
+ 
+@@ -2857,9 +2857,17 @@ gst_omx_video_dec_set_format (GstVideoDe
+   /*We cannot use GST_VIDEO_INFO_FIELD_HEIGHT() as encoded content may use either
+    * interlace-mode=interleaved or alternate. In both case we'll output alternate
+    * so the OMX frame height needs to be halfed. */
+-  if (GST_VIDEO_INFO_IS_INTERLACED (info))
++  if (GST_VIDEO_INFO_IS_INTERLACED (info)) {
+     port_def.format.video.nFrameHeight =
+         GST_ROUND_UP_2 (port_def.format.video.nFrameHeight / 2);
++    if (!interlaced_print_flag) {
++      g_print("Current stream mode is %s, but just support PROGRESSIVE type. \n",
++          gst_video_interlace_mode_to_string (info->interlace_mode));
++      GST_ERROR_OBJECT (self, "Just support PROGRESSIVE type ");
++      interlaced_print_flag = TRUE;
++    }
++    return FALSE;
++  }
+   port_def.format.video.xFramerate = framerate_q16;
+ 
+   if (klass->cdata.hacks & GST_OMX_HACK_PASS_COLOR_FORMAT_TO_DECODER) {
+diff -purN a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
+--- a/omx/gstomxvideoenc.c	2022-11-03 17:02:54.593333485 +0800
++++ b/omx/gstomxvideoenc.c	2022-11-03 13:46:10.137177818 +0800
+@@ -2136,7 +2136,7 @@ gst_omx_try_importing_buffer (GstOMXVide
+ 
+   if ( !gst_is_dmabuf_memory (mem)) {
+     GST_INFO_OBJECT (self,
+-        " %d-th buffer doesn't contain dmabuf, go to out. port->port_def.nBufferSize: %lu",
++        " %d-th buffer doesn't contain dmabuf, go to out. port->port_def.nBufferSize: %u",
+         i, port->port_def.nBufferSize);
+     goto out;
+   }
+@@ -2187,7 +2187,7 @@ gst_omx_video_enc_use_buffers (GstOMXVid
+   GList *frames = NULL;
+   OMX_ERRORTYPE err = OMX_ErrorNone;
+   gboolean is_mapped = FALSE ;
+-  GST_DEBUG(" nBufferCountActual=%d, nBufferCountMin= %lu", n, port->port_def.nBufferCountMin);
++  GST_DEBUG(" nBufferCountActual=%d, nBufferCountMin= %u", n, port->port_def.nBufferCountMin);
+ 
+   if ( pool != NULL ) {
+     guint i;

+ 92 - 5
multimedia/patch/mm_libs/0001-wave511-fix-building-issue.patch → multimedia/patch/mm_libs/0001-wave511-fix-building-issue-and-support-the-vendor-co.patch

@@ -1,15 +1,74 @@
-From 0e365b325c7ddd78087bb48c5c4d695f505a7f6b Mon Sep 17 00:00:00 2001
+From 1764dcc4a161e44e822029b1cc5c3bbc40f052e5 Mon Sep 17 00:00:00 2001
 From: Andy Hu <andy.hu@starfivetech.com>
-Date: Tue, 16 Aug 2022 19:52:20 +0800
-Subject: [PATCH] wave511: fix building issue
+Date: Fri, 18 Nov 2022 12:49:12 +0800
+Subject: [PATCH] wave511: fix building issue and support the vendor code
+ building
 
 ---
+ wave511/wave511/WaveDecDriver.mak            |  3 +-
+ wave511/wave511/WaveDecode-ffmpeg.mak        |  2 +-
+ wave511/wave511/WaveDecode.mak               |  2 +-
+ wave511/wave511/WaveDecodeMult.mak           |  2 +-
  wave511/wave511/WaveDecode_buildroot.mak     | 46 +++++++++++++++++++-
+ wave511/wave511/build_for_vdec.sh            | 12 +++--
  wave511/wave511/sample_v2/helper/vpuhelper.c | 19 +++++---
- 2 files changed, 59 insertions(+), 6 deletions(-)
+ 7 files changed, 72 insertions(+), 14 deletions(-)
 
+diff --git a/wave511/wave511/WaveDecDriver.mak b/wave511/wave511/WaveDecDriver.mak
+index 2323cd7..a2dc1e5 100644
+--- a/wave511/wave511/WaveDecDriver.mak
++++ b/wave511/wave511/WaveDecDriver.mak
+@@ -27,7 +27,8 @@ obj-m	:= vdec.o
+ 
+ else
+ 
+-KERNELDIR := ../../../work/linux
++#KERNELDIR := ../../../work/linux
++KERNELDIR := /lib/modules/$(shell uname -r)/build
+ 
+ PWD	  := $(shell pwd)
+ 
+diff --git a/wave511/wave511/WaveDecode-ffmpeg.mak b/wave511/wave511/WaveDecode-ffmpeg.mak
+index 05e642d..b19dd3e 100644
+--- a/wave511/wave511/WaveDecode-ffmpeg.mak
++++ b/wave511/wave511/WaveDecode-ffmpeg.mak
+@@ -59,7 +59,7 @@ ifeq ("$(BUILD_CONFIGURATION)", "EmbeddedLinux")
+ endif
+ 
+ ifeq ("$(BUILD_CONFIGURATION)", "EmbeddedRiscvLinux")
+-    CROSS_CC_PREFIX = riscv64-buildroot-linux-gnu-
++    CROSS_CC_PREFIX = 
+     PLATFORM        = riscvlinux
+ endif
+ CC  = $(CROSS_CC_PREFIX)gcc
+diff --git a/wave511/wave511/WaveDecode.mak b/wave511/wave511/WaveDecode.mak
+index 46cf8ab..3d0fb78 100644
+--- a/wave511/wave511/WaveDecode.mak
++++ b/wave511/wave511/WaveDecode.mak
+@@ -57,7 +57,7 @@ ifeq ("$(BUILD_CONFIGURATION)", "EmbeddedLinux")
+ endif
+ 
+ ifeq ("$(BUILD_CONFIGURATION)", "EmbeddedRiscvLinux")
+-    CROSS_CC_PREFIX = riscv64-buildroot-linux-gnu-
++    CROSS_CC_PREFIX =
+     PLATFORM        = riscvlinux
+ endif
+ CC  = $(CROSS_CC_PREFIX)gcc
+diff --git a/wave511/wave511/WaveDecodeMult.mak b/wave511/wave511/WaveDecodeMult.mak
+index f882100..ea3b06e 100644
+--- a/wave511/wave511/WaveDecodeMult.mak
++++ b/wave511/wave511/WaveDecodeMult.mak
+@@ -69,7 +69,7 @@ ifeq ("$(BUILD_CONFIGURATION)", "EmbeddedLinux")
+ endif
+ 
+ ifeq ("$(BUILD_CONFIGURATION)", "EmbeddedRiscvLinux")
+-    CROSS_CC_PREFIX = riscv64-buildroot-linux-gnu-
++    CROSS_CC_PREFIX = 
+     PLATFORM        = riscvlinux
+ endif
+ 
 diff --git a/wave511/wave511/WaveDecode_buildroot.mak b/wave511/wave511/WaveDecode_buildroot.mak
-index e8b9f06..d2d05f5 100644
+index 4343925..4af9c88 100644
 --- a/wave511/wave511/WaveDecode_buildroot.mak
 +++ b/wave511/wave511/WaveDecode_buildroot.mak
 @@ -11,6 +11,10 @@ PRODUCT := WAVE511
@@ -76,6 +135,34 @@ index e8b9f06..d2d05f5 100644
 +	$(INSTALL) -D -m 0644 vpuapi/vpuerror.h                                            $(STAGING_DIR)/usr/include/wave511/vpuapi/vpuerror.h
 +	$(INSTALL) -D -m 0644 vpuapi/vputypes.h                                            $(STAGING_DIR)/usr/include/wave511/vpuapi/vputypes.h
 +	$(INSTALL) -D -m 0644 vpuapi/vpuapifunc.h                                          $(STAGING_DIR)/usr/include/wave511/vpuapi/vpuapifunc.h
+diff --git a/wave511/wave511/build_for_vdec.sh b/wave511/wave511/build_for_vdec.sh
+index b23aba7..8e00d12 100755
+--- a/wave511/wave511/build_for_vdec.sh
++++ b/wave511/wave511/build_for_vdec.sh
+@@ -1,5 +1,9 @@
+ #!/bin/bash
+-source set_env.sh
++#source set_env.sh
++export ARCH=riscv
++export SUBARCH=riscv
++export CROSS_COMPILE=
++
+ CP="cp -rdvp"
+ OUTPUT=vdec_driver
+ DRI_OPT=$OUTPUT/driver
+@@ -19,9 +23,9 @@ make -f WaveDecode-ffmpeg.mak
+ $CP $DEC_FFMPEG_BIN $OUTPUT
+ make -f WaveDecode-ffmpeg.mak clean
+ 
+-make -f WaveDecDriver.mak
+-$CP $DRI_SRC/vdec.ko $DRI_OPT
+-make -f WaveDecDriver.mak clean
++#make -f WaveDecDriver.mak
++#$CP $DRI_SRC/vdec.ko $DRI_OPT
++#make -f WaveDecDriver.mak clean
+ 
+ make -f WaveDecode.mak
+ $CP $DEC_BIN $OUTPUT
 diff --git a/wave511/wave511/sample_v2/helper/vpuhelper.c b/wave511/wave511/sample_v2/helper/vpuhelper.c
 index d655562..8c8e888 100644
 --- a/wave511/wave511/sample_v2/helper/vpuhelper.c

+ 63 - 4
multimedia/patch/mm_libs/0002-wave420l-fix-building-issue.patch → multimedia/patch/mm_libs/0002-wave420l-fix-building-issue-and-support-the-vendor-c.patch

@@ -1,13 +1,30 @@
-From 0131ee14620181c35ce8ad775fb289fcb4cf0a38 Mon Sep 17 00:00:00 2001
+From ec8e1c94de16680f287b7d56b3674269ad7ed707 Mon Sep 17 00:00:00 2001
 From: Andy Hu <andy.hu@starfivetech.com>
-Date: Tue, 16 Aug 2022 21:52:55 +0800
-Subject: [PATCH] wave420l: fix building issue
+Date: Fri, 18 Nov 2022 12:51:32 +0800
+Subject: [PATCH] wave420l: fix building issue and support the vendor code
+ building
 
 ---
+ wave420l/code/Wave420Enc.mak            |  2 +-
  wave420l/code/WaveEncoder_buildroot.mak | 47 ++++++++++++++++++++++++-
+ wave420l/code/build.sh                  | 13 ++++---
  wave420l/code/sample/helper/vpuhelper.c | 24 +++++++++----
- 2 files changed, 64 insertions(+), 7 deletions(-)
+ wave420l/code/theoraparser/Makefile     |  2 +-
+ 5 files changed, 75 insertions(+), 13 deletions(-)
 
+diff --git a/wave420l/code/Wave420Enc.mak b/wave420l/code/Wave420Enc.mak
+index f719fa8..8b23cd4 100644
+--- a/wave420l/code/Wave420Enc.mak
++++ b/wave420l/code/Wave420Enc.mak
+@@ -43,7 +43,7 @@ ifeq ("$(BUILD_CONFIGURATION)", "EmbeddedLinux")
+ endif
+ 
+ ifeq ("$(BUILD_CONFIGURATION)", "RiscvLinux")
+-    CROSS_CC_PREFIX = riscv64-buildroot-linux-gnu-
++    CROSS_CC_PREFIX = 
+     PLATFORM        = riscvlinux
+     USE_FFMPEG  	= no
+     USE_PTHREAD 	= yes
 diff --git a/wave420l/code/WaveEncoder_buildroot.mak b/wave420l/code/WaveEncoder_buildroot.mak
 index a6ea84d..1f6b938 100755
 --- a/wave420l/code/WaveEncoder_buildroot.mak
@@ -70,6 +87,35 @@ index a6ea84d..1f6b938 100755
 +	$(INSTALL) -D -m 0644 vdi/vdi.h                                                    $(STAGING_DIR)/usr/include/wave420l/vdi/vdi.h
 +	$(INSTALL) -D -m 0644 vdi/vdi_osal.h                                               $(STAGING_DIR)/usr/include/wave420l/vdi/vdi_osal.h
 +	$(INSTALL) -D -m 0644 config.h                                                     $(STAGING_DIR)/usr/include/wave420l/config.h
+diff --git a/wave420l/code/build.sh b/wave420l/code/build.sh
+index 14fcf3d..c5f80b0 100755
+--- a/wave420l/code/build.sh
++++ b/wave420l/code/build.sh
+@@ -1,5 +1,10 @@
+ #!/bin/bash
+-. ./set_env.sh
++# . ./set_env.sh
++export ARCH=riscv
++export SUBARCH=riscv
++export CROSS_COMPILE=
++export BUILD_CONFIGURATION=RiscvLinux
++
+ CP="cp -rdvp"
+ OUTPUT=venc_driver
+ DRI_OPT=$OUTPUT/driver
+@@ -15,9 +20,9 @@ if [ ! -d $DRI_OPT ];then
+ 	mkdir -p $DRI_OPT
+ fi
+ 
+-make -f  Wave420Driver.mak
+-$CP $DRI_SRC/venc.ko $DRI_OPT
+-make -f  Wave420Driver.mak clean
++# make -f  Wave420Driver.mak
++# $CP $DRI_SRC/venc.ko $DRI_OPT
++# make -f  Wave420Driver.mak clean
+ 
+ make -f  Wave420Enc.mak
+ $CP $ENC_BIN $OUTPUT
 diff --git a/wave420l/code/sample/helper/vpuhelper.c b/wave420l/code/sample/helper/vpuhelper.c
 index 711375b..688dbf6 100644
 --- a/wave420l/code/sample/helper/vpuhelper.c
@@ -119,6 +165,19 @@ index 711375b..688dbf6 100644
          if (pEncConfig->bitstreamFileName[0] == 0 && pCfg->BitStreamFileName[0] != 0)
              sprintf(pEncConfig->bitstreamFileName, "%s", pCfg->BitStreamFileName);
  
+diff --git a/wave420l/code/theoraparser/Makefile b/wave420l/code/theoraparser/Makefile
+index 0a8686f..1d904da 100644
+--- a/wave420l/code/theoraparser/Makefile
++++ b/wave420l/code/theoraparser/Makefile
+@@ -11,7 +11,7 @@ ifeq ("$(BUILD_CONFIGURATION)", "NonOS")
+ endif
+ 
+ ifeq ("$(BUILD_CONFIGURATION)", "RiscvLinux")
+-    CROSS_CC_PREFIX = riscv64-buildroot-linux-gnu-
++    CROSS_CC_PREFIX =
+ endif
+ 
+ CC  = $(CROSS_CC_PREFIX)gcc
 -- 
 2.36.0
 

+ 52 - 4
multimedia/patch/mm_libs/0003-codaj12-fix-building-issue.patch → multimedia/patch/mm_libs/0003-codaj12-fix-building-issue-and-support-the-vendor-co.patch

@@ -1,12 +1,60 @@
-From 103b02bd32ed65174b16af02215807d8d0e133a6 Mon Sep 17 00:00:00 2001
+From e88d5d10314d2bbaa99c1ecf8bc9640555c1e674 Mon Sep 17 00:00:00 2001
 From: Andy Hu <andy.hu@starfivetech.com>
-Date: Tue, 16 Aug 2022 21:58:00 +0800
-Subject: [PATCH] codaj12: fix building issue
+Date: Fri, 18 Nov 2022 12:52:51 +0800
+Subject: [PATCH] codaj12: fix building issue and support the vendor code
+ building
 
 ---
+ codaj12/Makefile              |  2 +-
+ codaj12/build_for_riscv.sh    | 15 +++++++++------
  codaj12/codaj12_buildroot.mak | 31 ++++++++++++++++++++++++++++++-
- 1 file changed, 30 insertions(+), 1 deletion(-)
+ 3 files changed, 40 insertions(+), 8 deletions(-)
 
+diff --git a/codaj12/Makefile b/codaj12/Makefile
+index 8e41864..1be8a83 100644
+--- a/codaj12/Makefile
++++ b/codaj12/Makefile
+@@ -38,7 +38,7 @@ ifeq ("$(BUILD_CONFIGURATION)", "NonOS")
+     USE_ALLOCATOR   = yes
+ endif
+ ifeq ("$(BUILD_CONFIGURATION)", "EmbeddedLinux")
+-    CROSS_CC_PREFIX = riscv64-buildroot-linux-gnu-
++    CROSS_CC_PREFIX =
+     PLATFORM        = riscvlinux
+     USE_FFMPEG      ?= yes
+ endif
+diff --git a/codaj12/build_for_riscv.sh b/codaj12/build_for_riscv.sh
+index 75c1c31..dee8ad4 100755
+--- a/codaj12/build_for_riscv.sh
++++ b/codaj12/build_for_riscv.sh
+@@ -25,10 +25,13 @@ cp -rdvp ${jpu_path}/yuv $obj_jpu
+ cp -rdvp ${jpu_path}/stream $obj_jpu
+ 
+ #make linux driver
+-cd $jpu_driver
+-source build_env_setup_riscv.sh
+-make clean
+-make
++# cd $jpu_driver
++# source build_env_setup_riscv.sh
++# make clean
++# make
++export ARCH=riscv
++export SUBARCH=riscv
++export CROSS_COMPILE=
+ 
+ #make multi_instance
+ cd $jpu_path
+@@ -42,7 +45,7 @@ make USE_FFMPEG=no
+ cp ${jpu_path}/jpg_enc_test ${jpu_path}/jpg_dec_test $obj_jpu
+ 
+ #cp driver
+-cp ${jpu_driver}/jpu.ko $obj_jpu_driver
+-cp -rdvp jpu_driver ../../work/buildroot_initramfs_sysroot/root/
++# cp ${jpu_driver}/jpu.ko $obj_jpu_driver
++# cp -rdvp jpu_driver ../../work/buildroot_initramfs_sysroot/root/
+ 
+ 
 diff --git a/codaj12/codaj12_buildroot.mak b/codaj12/codaj12_buildroot.mak
 index bffe02d..6833f09 100644
 --- a/codaj12/codaj12_buildroot.mak

+ 17 - 16
multimedia/patch/mm_libs/0004-omx-il-fix-building-issue.patch → multimedia/patch/mm_libs/0004-omx-il-fix-building-issue-and-support-omx-test-examp.patch

@@ -1,14 +1,14 @@
-From 14143fcf2c4561905c11cae22314bb5dfdbe171c Mon Sep 17 00:00:00 2001
+From 023b1bd40ce616fbfa89905d44e4e90a9365ef0e Mon Sep 17 00:00:00 2001
 From: Andy Hu <andy.hu@starfivetech.com>
-Date: Wed, 17 Aug 2022 11:14:38 +0800
-Subject: [PATCH] omx-il: fix building issue
+Date: Fri, 18 Nov 2022 12:54:42 +0800
+Subject: [PATCH] omx-il: fix building issue and support omx test example
 
 ---
- omx-il/Makefile | 29 ++++++++++++++++++++++-------
- 1 file changed, 22 insertions(+), 7 deletions(-)
+ omx-il/Makefile | 34 +++++++++++++++++++++++++++-------
+ 1 file changed, 27 insertions(+), 7 deletions(-)
 
 diff --git a/omx-il/Makefile b/omx-il/Makefile
-index 150c4d5..a51de48 100644
+index 150c4d5..42be599 100644
 --- a/omx-il/Makefile
 +++ b/omx-il/Makefile
 @@ -10,7 +10,8 @@ BUILD_CONFIGURATION := EmbeddedRiscvLinux
@@ -36,23 +36,18 @@ index 150c4d5..a51de48 100644
  INCLUDES += -I$(STAGING_DIR)/usr/include/
  INCLUDES += -I$(STAGING_DIR)/usr/include/wave420l/
  INCLUDES += -I$(STAGING_DIR)/usr/include/wave420l/vpuapi/
-@@ -29,12 +34,13 @@ INCLUDES += -I$(STAGING_DIR)/usr/include/wave420l/sample/helper/
- 
- #mjpeg
- INCLUDES += -I./component/image/common
-+INCLUDES += -I../out/include
- 
+@@ -33,8 +38,8 @@ INCLUDES += -I./component/image/common
  CFLAGS  += -g -I. $(INCLUDES) $(DEFINES) $(PLATFORM_FLAGS)
  CFLAGS  += -fpic
  ARFLAGS += cru
 -LDFLAGS = -ldl -lpthread -Wl,--fatal-warning
 -LDFLAGS_FFMPEG = -lavformat -lavcodec -lavutil -lswresample
 +LDFLAGS = -L./  -ldl -lpthread -Wl,--fatal-warning
-+LDFLAGS_FFMPEG = -L../out/lib -lavformat -lavcodec -lavutil -lswresample 
++LDFLAGS_FFMPEG = -L$(STAGING_DIR)/usr/lib -lavformat -lavcodec -lavutil -lswresample
  
  OBJDIR=obj
  ALLOBJS=*.o
-@@ -86,18 +92,27 @@ omx-il: CREATE_DIR $(OBJECTPATHS_COMMON)
+@@ -86,18 +91,33 @@ omx-il: CREATE_DIR $(OBJECTPATHS_COMMON)
  test: video-dec-test video-enc-test mjpeg-dec-test
  
  video-dec-test: CREATE_DIR $(OBJECTPATHS_DEC_TEST)
@@ -61,7 +56,7 @@ index 150c4d5..a51de48 100644
  
  video-enc-test: CREATE_DIR $(OBJECTPATHS_ENC_TEST)
 -	$(CC) -o video_enc_test $(LDFLAGS) $(LDFLAGS_FFMPEG) -lsf-omx-il $(OBJECTPATHS_ENC_TEST) -L./
-+	$(CC) -o video_enc_test $(OBJECTPATHS_ENC_TEST) -L../out/lib -L./ -lsf-omx-il $(LDFLAGS_FFMPEG) $(LDFLAGS)
++	$(CC) -o video_enc_test $(OBJECTPATHS_ENC_TEST) -L./ -lsf-omx-il $(LDFLAGS_FFMPEG) $(LDFLAGS)
  
  mjpeg-dec-test: CREATE_DIR $(OBJECTPATHS_MJPEG_DEC_TEST)
 -	$(CC) -g -o mjpeg_dec_test $(LDFLAGS) $(LDFLAGS_FFMPEG) -lsf-omx-il $(OBJECTPATHS_MJPEG_DEC_TEST) -L./
@@ -78,11 +73,17 @@ index 150c4d5..a51de48 100644
  	$(CC) $(CFLAGS) -Wall -Werror -c $< -o $@ -MD -MF $(@:.o=.dep)
 +
 +install:
-+	@echo "install omx-il to STAGING_DIR ..."
++	@echo "install omx-il library to STAGING_DIR $(STAGING_DIR)..."
 +	$(INSTALL) -m 0644 libsf-omx-il.so $(STAGING_DIR)/usr/lib/libsf-omx-il.so
 +	ln -sf libsf-omx-il.so $(STAGING_DIR)/usr/lib/libOMX_Core.so
 +	$(INSTALL) -d include/khronos $(STAGING_DIR)/usr/include/omx-il
 +	$(INSTALL) -m 0644 include/khronos/* $(STAGING_DIR)/usr/include/omx-il
++
++install_test:
++	@echo "install omx-il test to STAGING_DIR $(STAGING_DIR)..."
++	$(INSTALL) -m 0755 video_dec_test $(STAGING_DIR)/usr/bin/
++	$(INSTALL) -m 0755 video_enc_test $(STAGING_DIR)/usr/bin/
++	$(INSTALL) -m 0755 mjpeg_dec_test $(STAGING_DIR)/usr/bin/
 -- 
 2.36.0
 

+ 32 - 0
multimedia/patch/mm_libs/0005-wave511-fix-the-warning-which-treated-as-error.patch

@@ -0,0 +1,32 @@
+From 7c64b3981f1fc12c47acd825831e0b633181bc63 Mon Sep 17 00:00:00 2001
+From: Andy Hu <andy.hu@starfivetech.com>
+Date: Thu, 19 Jan 2023 16:24:25 +0800
+Subject: [PATCH] wave511: fix the warning which treated as error
+
+---
+ wave511/wave511/sample_v2/helper/main_helper.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/wave511/wave511/sample_v2/helper/main_helper.c b/wave511/wave511/sample_v2/helper/main_helper.c
+index 4e3fb26..d812f8f 100644
+--- a/wave511/wave511/sample_v2/helper/main_helper.c
++++ b/wave511/wave511/sample_v2/helper/main_helper.c
+@@ -2158,13 +2158,13 @@ void GenRegionToQpMap(
+ int openRoiMapFile(TestEncConfig *encConfig)
+ {
+     if (encConfig->roi_enable) {
+-        if (encConfig->roi_file_name) {
++        // if (encConfig->roi_file_name) {
+             ChangePathStyle(encConfig->roi_file_name);
+             if ((encConfig->roi_file = osal_fopen(encConfig->roi_file_name, "r")) == NULL) {
+                 VLOG(ERR, "fail to open ROI file, %s\n", encConfig->roi_file_name);
+                 return FALSE;
+             }
+-        }
++        // }
+     }
+     return TRUE;
+ }
+-- 
+2.36.0
+

+ 105 - 0
multimedia/patch/mm_libs/0006-wave420l-Fix-Werror-address-issue-or-add-Waddress-in.patch

@@ -0,0 +1,105 @@
+From 5178b06a922d9ee5e9688329cd4f3ba38e7f5143 Mon Sep 17 00:00:00 2001
+From: Andy Hu <andy.hu@starfivetech.com>
+Date: Thu, 19 Jan 2023 16:35:56 +0800
+Subject: [PATCH] wave420l: Fix -Werror=address issue or add Waddress in
+ Makefile
+
+---
+ wave420l/code/sample/helper/main_helper.c | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/wave420l/code/sample/helper/main_helper.c b/wave420l/code/sample/helper/main_helper.c
+index dc6e90e..e1b4a1c 100644
+--- a/wave420l/code/sample/helper/main_helper.c
++++ b/wave420l/code/sample/helper/main_helper.c
+@@ -1229,7 +1229,7 @@ Int32 writeVuiRbsp(int coreIdx, TestEncConfig *encConfig, EncOpenParam *encOP, v
+         }
+         encOP->vuiRbspDataAddr = vbVuiRbsp->phys_addr;
+ 
+-        if (encConfig->vui_rbsp_file_name) {
++        // if (encConfig->vui_rbsp_file_name) {
+             Uint8   *pVuiRbspBuf;
+             Int32   rbspSizeInByte = (encOP->vuiRbspDataSize+7)>>3;
+             ChangePathStyle(encConfig->vui_rbsp_file_name);
+@@ -1246,7 +1246,7 @@ Int32 writeVuiRbsp(int coreIdx, TestEncConfig *encConfig, EncOpenParam *encOP, v
+             osal_fread(pVuiRbspBuf, 1, rbspSizeInByte, encConfig->vui_rbsp_fp);
+             vdi_write_memory(coreIdx, encOP->vuiRbspDataAddr, pVuiRbspBuf,  rbspSizeInByte, encOP->streamEndian);
+             osal_free(pVuiRbspBuf);
+-        }
++        // }
+     }
+     return TRUE;
+ }
+@@ -1263,7 +1263,7 @@ Int32 writeHrdRbsp(int coreIdx, TestEncConfig *encConfig, EncOpenParam *encOP, v
+ 
+         encOP->hrdRbspDataAddr = vbHrdRbsp->phys_addr;
+ 
+-        if (encConfig->hrd_rbsp_file_name) {
++        // if (encConfig->hrd_rbsp_file_name) {
+             Uint8   *pHrdRbspBuf;
+             Int32   rbspSizeInByte = (encOP->hrdRbspDataSize+7)>>3;
+             ChangePathStyle(encConfig->hrd_rbsp_file_name);
+@@ -1280,7 +1280,7 @@ Int32 writeHrdRbsp(int coreIdx, TestEncConfig *encConfig, EncOpenParam *encOP, v
+             osal_fread(pHrdRbspBuf, 1, rbspSizeInByte, encConfig->hrd_rbsp_fp);
+             vdi_write_memory(coreIdx, encOP->hrdRbspDataAddr, pHrdRbspBuf,  rbspSizeInByte, encOP->streamEndian);
+             osal_free(pHrdRbspBuf);
+-        }
++        // }
+     }
+     return TRUE;
+ }
+@@ -1505,7 +1505,7 @@ int setRoiMap(int coreIdx, TestEncConfig *encConfig, EncOpenParam encOP, Physica
+         // sample code to convert ROI coordinate to ROI map.
+         osal_memset(&encConfig->region[0], 0, sizeof(VpuRect)*MAX_ROI_NUMBER);
+         osal_memset(&encConfig->roiLevel[0], 0, sizeof(int)*MAX_ROI_NUMBER);
+-        if (encConfig->roi_file_name) {
++        // if (encConfig->roi_file_name) {
+             char lineStr[256] = {0, };
+             int  val;
+             fgets(lineStr, 256, encConfig->roi_file);
+@@ -1525,7 +1525,7 @@ int setRoiMap(int coreIdx, TestEncConfig *encConfig, EncOpenParam encOP, Physica
+                     VLOG(ERR, "CFG file error : %s value is not available. \n", encConfig->roi_file_name);
+                 }
+             }
+-        }
++        // }
+         encParam->ctuOptParam.addrRoiCtuMap = addrRoiMap;
+         encParam->ctuOptParam.mapEndian     = VDI_LITTLE_ENDIAN;
+         encParam->ctuOptParam.mapStride     = ((encOP.picWidth+63)&~63)>>6;
+@@ -1580,13 +1580,13 @@ int checkParamRestriction(Uint32 productId, TestEncConfig *encConfig)
+ int openRoiMapFile(TestEncConfig *encConfig) 
+ {
+     if (encConfig->roi_enable) {
+-        if (encConfig->roi_file_name) {
++        // if (encConfig->roi_file_name) {
+             ChangePathStyle(encConfig->roi_file_name);
+             if ((encConfig->roi_file = osal_fopen(encConfig->roi_file_name, "r")) == NULL) {
+                 VLOG(ERR, "fail to open ROI file, %s\n", encConfig->roi_file_name);
+                 return FALSE;
+             }
+-        }
++        // }
+     }
+     return TRUE;
+ }
+@@ -1617,7 +1617,7 @@ int setCtuQpMap(int coreIdx, TestEncConfig *encConfig, EncOpenParam encOP, Physi
+         // sample code to convert CTU coordinate to CTU MODE map.
+         osal_memset(&encConfig->region[0], 0, sizeof(VpuRect)*MAX_ROI_NUMBER);
+         osal_memset(&encConfig->ctuQp[0], 0, sizeof(int)*MAX_ROI_NUMBER);
+-        if (encConfig->ctuqp_file_name) {
++        // if (encConfig->ctuqp_file_name) {
+             char lineStr[256] = {0, };
+             int  val;
+             fgets(lineStr, 256, encConfig->ctuqp_file);
+@@ -1637,7 +1637,7 @@ int setCtuQpMap(int coreIdx, TestEncConfig *encConfig, EncOpenParam encOP, Physi
+                     VLOG(ERR, "CFG file error : %s value is not available. \n", encConfig->ctuqp_file_name);
+                 }
+             }
+-        }
++        // }
+         encParam->ctuOptParam.addrCtuQpMap  = addrCtuQpMap;
+         encParam->ctuOptParam.mapEndian     = VDI_LITTLE_ENDIAN;
+         encParam->ctuOptParam.mapStride     = ((encOP.picWidth+63)&~63)>>6;
+-- 
+2.36.0
+

+ 71 - 0
multimedia/patch/mm_libs/0007-omx-il-Fix-warning-issue-for-new-glibc.patch

@@ -0,0 +1,71 @@
+From e335a0ec4a6bf6fe3b41c122fd3464731168be2a Mon Sep 17 00:00:00 2001
+From: Andy Hu <andy.hu@starfivetech.com>
+Date: Thu, 19 Jan 2023 19:20:03 +0800
+Subject: [PATCH] omx-il: Fix warning issue for new glibc
+
+---
+ omx-il/tests/dec_test.c       | 10 +++++-----
+ omx-il/tests/enc_test.c       |  4 +---
+ omx-il/tests/mjpeg_dec_test.c | 10 +++++-----
+ 3 files changed, 11 insertions(+), 13 deletions(-)
+
+diff --git a/omx-il/tests/dec_test.c b/omx-il/tests/dec_test.c
+index cb56d18..afd3109 100644
+--- a/omx-il/tests/dec_test.c
++++ b/omx-il/tests/dec_test.c
+@@ -333,11 +333,11 @@ int main(int argc, char **argv)
+         }
+     }
+ 
+-    if (decodeTestContext->sInputFilePath == NULL || decodeTestContext->sOutputFilePath == NULL)
+-    {
+-        help();
+-        return -1;
+-    }
++    // if (decodeTestContext->sInputFilePath == NULL || decodeTestContext->sOutputFilePath == NULL)
++    // {
++    //     help();
++    //     return -1;
++    // }
+     /*ffmpeg init*/
+     printf("init ffmpeg\r\n");
+     AVFormatContext *avContext = NULL;
+diff --git a/omx-il/tests/enc_test.c b/omx-il/tests/enc_test.c
+index 169945b..721b8d0 100644
+--- a/omx-il/tests/enc_test.c
++++ b/omx-il/tests/enc_test.c
+@@ -340,9 +340,7 @@ int main(int argc, char **argv)
+     }
+ 
+     encodeTestContext->nFrameBufferSize = width * height * 3 / 2;
+-    if (encodeTestContext->sInputFilePath == NULL ||
+-        encodeTestContext->sOutputFilePath == NULL ||
+-        encodeTestContext->nFrameBufferSize == 0 ||
++    if (encodeTestContext->nFrameBufferSize == 0 ||
+         encodeTestContext->pInputFile == NULL)
+     {
+         help();
+diff --git a/omx-il/tests/mjpeg_dec_test.c b/omx-il/tests/mjpeg_dec_test.c
+index 17d0826..c827a59 100644
+--- a/omx-il/tests/mjpeg_dec_test.c
++++ b/omx-il/tests/mjpeg_dec_test.c
+@@ -376,11 +376,11 @@ int main(int argc, char **argv)
+         }
+     }
+ 
+-    if (decodeTestContext->sInputFilePath == NULL || decodeTestContext->sOutputFilePath == NULL)
+-    {
+-        help();
+-        return -1;
+-    }
++    // if (decodeTestContext->sInputFilePath == NULL || decodeTestContext->sOutputFilePath == NULL)
++    // {
++    //     help();
++    //     return -1;
++    // }
+     if ((decodeTestContext->ScaleFactorH || decodeTestContext->ScaleFactorV) && decodeTestContext->Rotation)
+     {
+         printf("Invalid operation mode : Rotation cannot work with the scaler");
+-- 
+2.36.0
+

+ 14 - 23
multimedia/run_env.sh

@@ -6,31 +6,16 @@
 ##      Copyright (C) 2018-2022   Starfive Technology           ##
 ##                                                              ##
 ##################################################################
-
-CURDIR=$(cd `dirname $0`; pwd)
-export LD_LIBRARY_PATH=$CURDIR/target/usr/lib/
-
-## load wave511 vdec.ko
-pushd $CURDIR/target/root/wave511
-./vdec_load.sh
-popd
-
-## load wave420l venc.ko
-pushd $CURDIR/target/root/wave420l
-./venc_load.sh
-popd
-
-## load codaj12 jpu.ko
-pushd $CURDIR/target/root/codaj12
-./load.sh
-popd
+export LD_LIBRARY_PATH=$(pwd)/target/usr/lib/:$LD_LIBRARY_PATH
+export GST_PLUGIN_PATH=$(pwd)/target/usr/lib/gstreamer-1.0/
+export GST_PLUGIN_SCANNER=$(pwd)/target/usr/libexec/gstreamer-1.0/gst-plugin-scanner
+export PATH=$(pwd)/target/usr/bin:$PATH
+export DISPLAY=:0.0
 
 ## e.g.: ffmpeg use h264_omx to hard decode 264 file and output to yuv420p file, use 7yuv tool to check
-#$CURDIR/target/usr/bin/ffmpeg  -vcodec h264_omx -i Sintel_720_10s_10MB.mp4 -pix_fmt yuv420p 720p_i420.yuv
-
-## e.g. ffplay use h264_omx to hard decode and play video on SDL2.
-## Note: this not good now, will fix it asap
-#$CURDIR/target/usr/bin/ffplay  -vcodec h264_omx -i Sintel_720_10s_10MB.mp4
+# $(pwd)/target/usr/bin/ffmpeg -v verbose -vcodec h264_omx -i Sintel_720_10s_10MB.mp4 -pix_fmt yuv420p 720p_i420.yuv
+# $(pwd)/target/usr/bin/ffplay -v verbose -vcodec h264_omx -i Sintel_720_10s_10MB.mp4
+# $(pwd)/target/usr/bin/ffplay -v verbose -vcodec hevc_omx -i /test1_720P.h265
 
 ## e.g. gstreamer decode + display
 # gst-launch-1.0 filesrc location=Audio_Video_Sync_Test_1_1920x1080.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! xvimagesink
@@ -39,3 +24,9 @@ popd
 # gst-launch-1.0 filesrc location=2k.18fps.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h265parse ! omxh265dec ! videoconvert ! videoscale ! xvimagesink
 # gst-launch-1.0 filesrc location=youtube002_1080p_h264_aac.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! xvimagesink
 # gst-launch-1.0 filesrc location=file_example_MP4_640_3MG.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! xvimagesink
+
+## omx unit test
+# $(pwd)/target/usr/bin/video_dec_test -i /1080P.h265 -o 1080P_nv12.yuv -f nv12
+# $(pwd)/target/usr/bin/video_dec_test -i /test1_720P.h265 -o test1_720P_nv12.yuv -f nv12
+# $(pwd)/target/usr/bin/video_enc_test -i /1080p_30fps_HEVC_nv12.yuv -o 1080p_HEVC_NV12_omx.h265 -s h265 -w 1920 -h 1080 -b 5120000 -c nv12
+# $(pwd)/target/usr/bin/mjpeg_dec_test -i /test1_1080P_mjpeg.mp4 -o test1_1080P_mjpeg.yuv -f i420