ffmpeg add hwaccels

 Thu, 21-Dec-2023 01:43:37

ffmpeg add hwaccels :

diff --git a/configure b/configure
index fb55e04..ce26171 100755
--- a/configure
+++ b/configure
@@ -104,6 +104,7 @@ Licensing options:
 Configuration options:
   --disable-static         do not build static libraries [no]
   --enable-shared          build shared libraries [no]
+  --enable-rv1126vdec      use rockchip video decoder [no]
   --enable-small           optimize for size instead of speed
   --disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary)
   --enable-gray            enable full grayscale support (slower color)
@@ -1869,6 +1870,7 @@ HWACCEL_LIBRARY_LIST="
     omx
     opencl
     vulkan
+    rv1126vdec
 "

 DOCUMENT_LIST="
@@ -2949,6 +2951,8 @@ h264_nvdec_hwaccel_deps="nvdec"
 h264_nvdec_hwaccel_select="h264_decoder"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
+h264_rv1126vdec_hwaccel_deps="rv1126vdec"
+h264_rv1126vdec_hwaccel_select="h264_decoder"
 h264_vdpau_hwaccel_deps="vdpau"
 h264_vdpau_hwaccel_select="h264_decoder"
 h264_videotoolbox_hwaccel_deps="videotoolbox"
@@ -4066,6 +4070,7 @@ for opt do
             enable sdl2
         ;;
         --enable-*=*|--disable-*=*)
+
             eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
             is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
             eval list=\$$(toupper $thing)_LIST
@@ -4093,6 +4098,7 @@ for opt do
             elif is_in $option $CMDLINE_SELECT; then
                 $action $option
             else
+               echo "option should be in CMDLINE_SELECT"
                 die_unknown $opt
             fi
         ;;
@@ -6756,6 +6762,10 @@ enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.
 enabled vulkan &&
     require_pkg_config vulkan "vulkan >= 1.1.97" "vulkan/vulkan.h" vkCreateInstance

+if enabled rv1126vdec; then
+       echo "yyyyyyyyyyyy rv1126vdec"
+fi
+
 if enabled x86; then
     case $target_os in
         mingw32*|mingw64*|win32|win64|linux|cygwin*)
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b3d284d..b020759 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -924,6 +924,7 @@ OBJS-$(CONFIG_VAAPI)                      += vaapi_decode.o
 OBJS-$(CONFIG_VIDEOTOOLBOX)               += videotoolbox.o
 OBJS-$(CONFIG_VDPAU)                      += vdpau.o

+OBJS-$(CONFIG_H264_RV1126VDEC_HWACCEL)    += rv1126_h264.o
 OBJS-$(CONFIG_AV1_D3D11VA_HWACCEL)        += dxva2_av1.o
 OBJS-$(CONFIG_AV1_DXVA2_HWACCEL)          += dxva2_av1.o
 OBJS-$(CONFIG_AV1_NVDEC_HWACCEL)          += nvdec_av1.o
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 7c69016..6915be2 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -765,6 +765,8 @@ static void init_scan_tables(H264Context *h)

 static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
 {
+// TODO: add rv1126 accel
+
 #define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \
                      (CONFIG_H264_D3D11VA_HWACCEL * 2) + \
                      CONFIG_H264_NVDEC_HWACCEL + \
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index bf3ab88..03768c6 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -1079,6 +1079,9 @@ AVCodec ff_h264_decoder = {
 #endif
 #if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
                                HWACCEL_VIDEOTOOLBOX(h264),
+#endif
+#if CONFIG_H264_RV1126VDEC_HWACCEL
+                               HWACCEL_RV1126VDEC(h264),
 #endif
                                NULL
                            },
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index 8e54cf7..7c210de 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -34,6 +34,7 @@ extern const AVHWAccel ff_h264_dxva2_hwaccel;
 extern const AVHWAccel ff_h264_nvdec_hwaccel;
 extern const AVHWAccel ff_h264_vaapi_hwaccel;
 extern const AVHWAccel ff_h264_vdpau_hwaccel;
+extern const AVHWAccel ff_h264_rv1126vdec_hwaccel;
 extern const AVHWAccel ff_h264_videotoolbox_hwaccel;
 extern const AVHWAccel ff_hevc_d3d11va_hwaccel;
 extern const AVHWAccel ff_hevc_d3d11va2_hwaccel;