Credit Andrew + Terje testing Intel hardware qsv and vaapi additions
authorGood Guy <good1.2guy@gmail.com>
Tue, 10 Dec 2024 18:29:41 +0000 (11:29 -0700)
committerGood Guy <good1.2guy@gmail.com>
Tue, 10 Dec 2024 18:29:41 +0000 (11:29 -0700)
31 files changed:
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/ffmpeg.h
cinelerra-5.1/ffmpeg/video/av1_qsv_10b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/av1_qsv_10b420.webm [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/av1_qsv_8b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/av1_qsv_8b420.webm [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/av1_vaapi_10b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/av1_vaapi_10b420.webm [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/av1_vaapi_8b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/av1_vaapi_8b420.webm [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/h264_mediacodec.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/h264_qsv_8b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/h264_vaapi_8b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/hevc_mediacodec.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/hevc_qsv_10b420.mp4
cinelerra-5.1/ffmpeg/video/hevc_qsv_10b422.mp4
cinelerra-5.1/ffmpeg/video/hevc_qsv_8b420.mp4
cinelerra-5.1/ffmpeg/video/hevc_vaapi_10b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/hevc_vaapi_10b422.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/hevc_vaapi_8b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/mpeg2_hdv.mpeg [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/presets_vaapi.tar [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/vp9_qsv_10b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/vp9_qsv_10b420.webm [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/vp9_qsv_8b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/vp9_qsv_8b420.webm [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/vp9_vaapi_10b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/vp9_vaapi_10b420.webm [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/vp9_vaapi_8b420.mp4 [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/vp9_vaapi_8b420.webm [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/mjpegtools-2.2.1.patch9 [new file with mode: 0644]

index 7521c0bab567ada4ef9243084f6e291d9bf53174..075ef4dd22165462bf67ebc2e89af0c85a62f2ec 100644 (file)
@@ -1194,7 +1194,7 @@ int FFVideoStream::decode_hw_format(AVCodec *decoder, AVHWDeviceType type)
        return ret;
 }
 
-AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
+AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev, const char *hw_sformat)
 {
        const char *drm_node_enc = getenv("CIN_DRM_ENC");
        AVBufferRef *hw_device_ctx = 0;
@@ -1230,6 +1230,7 @@ AVHWDeviceType FFVideoStream::encode_hw_activate(const char *hw_dev)
                AVHWFramesContext *frames_ctx = (AVHWFramesContext *)(hw_frames_ref->data);
                frames_ctx->format = AV_PIX_FMT_VAAPI;
                frames_ctx->sw_format = AV_PIX_FMT_NV12;
+               if (strcmp(hw_sformat, "vaapi")) frames_ctx->sw_format = av_get_pix_fmt(hw_sformat);
                frames_ctx->width = width;
                frames_ctx->height = height;
                frames_ctx->initial_pool_size = 0; // 200;
@@ -2900,6 +2901,16 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
        FFStream *fst = 0;
        AVStream *st = 0;
        AVCodecContext *ctx = 0;
+       
+       /* some encoders dislike ildct flag in ffmpeg 7.0/7.1 */
+       int is_no_ildct;
+       if (!strcmp (codec_name, "av1_qsv") ||
+       !strcmp(codec_name, "h264_qsv") ||
+       !strcmp(codec_name, "vp9_qsv"))
+               is_no_ildct=1;
+       else
+               is_no_ildct=0;
+
 
        const AVCodecDescriptor *codec_desc = 0;
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
@@ -3057,7 +3068,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
                        }
                        AVPixelFormat pix_fmt = av_get_pix_fmt(asset->ff_pixel_format);
                        if( opt_hw_dev != 0 ) {
-                               AVHWDeviceType hw_type = vid->encode_hw_activate(opt_hw_dev);
+                               AVHWDeviceType hw_type = vid->encode_hw_activate(opt_hw_dev, asset->ff_pixel_format);
                                switch( hw_type ) {
                                case AV_HWDEVICE_TYPE_VAAPI:
                                        pix_fmt = AV_PIX_FMT_VAAPI;
@@ -3110,7 +3121,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
                        av_dict_set(&sopts, "field_order", "tt", 0); 
                        else
                        av_dict_set(&sopts, "field_order", "tb", 0); 
-                       if (ctx->codec_id != AV_CODEC_ID_MJPEG) 
+                       if (ctx->codec_id != AV_CODEC_ID_MJPEG && !is_no_ildct
                        av_dict_set(&sopts, "flags", "+ilme+ildct", 0);
                        break;
                        case ILACE_MODE_BOTTOM_FIRST: 
@@ -3118,7 +3129,7 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
                        av_dict_set(&sopts, "field_order", "bb", 0); 
                        else
                        av_dict_set(&sopts, "field_order", "bt", 0); 
-                       if (ctx->codec_id != AV_CODEC_ID_MJPEG)
+                       if (ctx->codec_id != AV_CODEC_ID_MJPEG && !is_no_ildct)
                        av_dict_set(&sopts, "flags", "+ilme+ildct", 0);
                        break;
                        case ILACE_MODE_NOTINTERLACED: av_dict_set(&sopts, "field_order", "progressive", 0); break;
index ed864b59663dda321523ef54ee68aec587831744..5253d9c70b6c6871c1d8d93638f8537e03c91014 100644 (file)
@@ -278,7 +278,7 @@ public:
 #else
        int decode_hw_format(AVCodec *decoder, AVHWDeviceType type);
 #endif
-       AVHWDeviceType encode_hw_activate(const char *hw_dev);
+       AVHWDeviceType encode_hw_activate(const char *hw_dev, const char *hw_sformat);
        int encode_hw_write(FFrame *picture);
        int encode_frame(AVFrame *frame);
        int create_filter(const char *filter_spec);
diff --git a/cinelerra-5.1/ffmpeg/video/av1_qsv_10b420.mp4 b/cinelerra-5.1/ffmpeg/video/av1_qsv_10b420.mp4
new file mode 100644 (file)
index 0000000..3124c59
--- /dev/null
@@ -0,0 +1,4 @@
+mp4 av1_qsv
+cin_pix_fmt=p010le
+profile=main
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/av1_qsv_10b420.webm b/cinelerra-5.1/ffmpeg/video/av1_qsv_10b420.webm
new file mode 100644 (file)
index 0000000..4269b21
--- /dev/null
@@ -0,0 +1,4 @@
+webm av1_qsv
+cin_pix_fmt=p010le
+profile=main
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/av1_qsv_8b420.mp4 b/cinelerra-5.1/ffmpeg/video/av1_qsv_8b420.mp4
new file mode 100644 (file)
index 0000000..3034c4c
--- /dev/null
@@ -0,0 +1,4 @@
+mp4 av1_qsv
+cin_pix_fmt=nv12
+profile=main
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/av1_qsv_8b420.webm b/cinelerra-5.1/ffmpeg/video/av1_qsv_8b420.webm
new file mode 100644 (file)
index 0000000..e6dd5ba
--- /dev/null
@@ -0,0 +1,4 @@
+webm av1_qsv
+cin_pix_fmt=nv12
+profile=main
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/av1_vaapi_10b420.mp4 b/cinelerra-5.1/ffmpeg/video/av1_vaapi_10b420.mp4
new file mode 100644 (file)
index 0000000..20ed818
--- /dev/null
@@ -0,0 +1,5 @@
+mp4 av1_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=p010le
+profile=main
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/av1_vaapi_10b420.webm b/cinelerra-5.1/ffmpeg/video/av1_vaapi_10b420.webm
new file mode 100644 (file)
index 0000000..07b74be
--- /dev/null
@@ -0,0 +1,5 @@
+webm av1_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=p010le
+profile=main
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/av1_vaapi_8b420.mp4 b/cinelerra-5.1/ffmpeg/video/av1_vaapi_8b420.mp4
new file mode 100644 (file)
index 0000000..ce41a32
--- /dev/null
@@ -0,0 +1,5 @@
+mp4 av1_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=nv12
+profile=main
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/av1_vaapi_8b420.webm b/cinelerra-5.1/ffmpeg/video/av1_vaapi_8b420.webm
new file mode 100644 (file)
index 0000000..117ebb1
--- /dev/null
@@ -0,0 +1,5 @@
+webm av1_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=nv12
+profile=main
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/h264_mediacodec.mp4 b/cinelerra-5.1/ffmpeg/video/h264_mediacodec.mp4
new file mode 100644 (file)
index 0000000..b0bce96
--- /dev/null
@@ -0,0 +1,3 @@
+mp4 h264_mediacodec
+cin_pix_fmt=yuv420p
+pix_fmt=yuv420p
\ No newline at end of file
diff --git a/cinelerra-5.1/ffmpeg/video/h264_qsv_8b420.mp4 b/cinelerra-5.1/ffmpeg/video/h264_qsv_8b420.mp4
new file mode 100644 (file)
index 0000000..145ad67
--- /dev/null
@@ -0,0 +1,4 @@
+mp4 h264_qsv
+cin_pix_fmt=nv12
+profile=high
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/h264_vaapi_8b420.mp4 b/cinelerra-5.1/ffmpeg/video/h264_vaapi_8b420.mp4
new file mode 100644 (file)
index 0000000..1a45760
--- /dev/null
@@ -0,0 +1,5 @@
+mp4 h264_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=nv12
+profile=high
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/hevc_mediacodec.mp4 b/cinelerra-5.1/ffmpeg/video/hevc_mediacodec.mp4
new file mode 100644 (file)
index 0000000..4f3bac1
--- /dev/null
@@ -0,0 +1,3 @@
+mp4 hevc_mediacodec
+cin_pix_fmt=yuv420p
+pix_fmt=yuv420p
\ No newline at end of file
index 1f1838832dd3eee7d30bc5feebbad333c5922c92..ebc8ddb28fcbce0ef9b8abab5eb4b3bcd3dc4135 100644 (file)
@@ -1,5 +1,5 @@
-mp4 hevc_qsv_10b420
-# usable with Pixels: p010le
+mp4 hevc_qsv
+cin_pix_fmt=p010le
 profile=main10
 # global_quality=25
 
index 421caf12d368f9b896ff4441478857b79b0f9029..04e47034a98c97af833b95cd74275730c02b5992 100644 (file)
@@ -1,5 +1,5 @@
-mp4 hevc_qsv_10b422
-# usable with Pixels: y210le
+mp4 hevc_qsv
+cin_pix_fmt=y210le
 profile=0
 # global_quality=25
 
index 96c60ede6dc49137a4645f2f6dc7f64d8c4c466b..66eadbbb36a92b276e3caf59acb5be03210e018f 100644 (file)
@@ -1,4 +1,4 @@
-mp4 hevc_qsv_8b420
-# usable with Pixels: nv12
+mp4 hevc_qsv
+cin_pix_fmt=nv12
 profile=main
 # global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/hevc_vaapi_10b420.mp4 b/cinelerra-5.1/ffmpeg/video/hevc_vaapi_10b420.mp4
new file mode 100644 (file)
index 0000000..3639b3b
--- /dev/null
@@ -0,0 +1,5 @@
+mp4 hevc_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=p010le
+profile=main10
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/hevc_vaapi_10b422.mp4 b/cinelerra-5.1/ffmpeg/video/hevc_vaapi_10b422.mp4
new file mode 100644 (file)
index 0000000..3a64bf7
--- /dev/null
@@ -0,0 +1,5 @@
+mp4 hevc_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=y210le
+profile=rext
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/hevc_vaapi_8b420.mp4 b/cinelerra-5.1/ffmpeg/video/hevc_vaapi_8b420.mp4
new file mode 100644 (file)
index 0000000..08c598e
--- /dev/null
@@ -0,0 +1,5 @@
+mp4 hevc_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=nv12
+profile=main
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/mpeg2_hdv.mpeg b/cinelerra-5.1/ffmpeg/video/mpeg2_hdv.mpeg
new file mode 100644 (file)
index 0000000..581f068
--- /dev/null
@@ -0,0 +1,9 @@
+mpeg mpeg2video
+trellis=1
+mbd=rd
+cmp=satd
+subcmp=satd
+b=25000000
+g=15
+bf=2
+b_strategy=1
diff --git a/cinelerra-5.1/ffmpeg/video/presets_vaapi.tar b/cinelerra-5.1/ffmpeg/video/presets_vaapi.tar
new file mode 100644 (file)
index 0000000..bb4d1bd
Binary files /dev/null and b/cinelerra-5.1/ffmpeg/video/presets_vaapi.tar differ
diff --git a/cinelerra-5.1/ffmpeg/video/vp9_qsv_10b420.mp4 b/cinelerra-5.1/ffmpeg/video/vp9_qsv_10b420.mp4
new file mode 100644 (file)
index 0000000..bc26996
--- /dev/null
@@ -0,0 +1,4 @@
+mp4 vp9_qsv
+cin_pix_fmt=p010le
+profile=0
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/vp9_qsv_10b420.webm b/cinelerra-5.1/ffmpeg/video/vp9_qsv_10b420.webm
new file mode 100644 (file)
index 0000000..9719b00
--- /dev/null
@@ -0,0 +1,4 @@
+webm vp9_qsv
+cin_pix_fmt=p010le
+profile=0
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/vp9_qsv_8b420.mp4 b/cinelerra-5.1/ffmpeg/video/vp9_qsv_8b420.mp4
new file mode 100644 (file)
index 0000000..f3ed61c
--- /dev/null
@@ -0,0 +1,4 @@
+mp4 vp9_qsv
+cin_pix_fmt=nv12
+profile=0
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/vp9_qsv_8b420.webm b/cinelerra-5.1/ffmpeg/video/vp9_qsv_8b420.webm
new file mode 100644 (file)
index 0000000..6652fbb
--- /dev/null
@@ -0,0 +1,4 @@
+webm vp9_qsv
+cin_pix_fmt=nv12
+profile=0
+# global_quality=25
diff --git a/cinelerra-5.1/ffmpeg/video/vp9_vaapi_10b420.mp4 b/cinelerra-5.1/ffmpeg/video/vp9_vaapi_10b420.mp4
new file mode 100644 (file)
index 0000000..686083c
--- /dev/null
@@ -0,0 +1,5 @@
+mp4 vp9_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=p010le
+profile=0
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/vp9_vaapi_10b420.webm b/cinelerra-5.1/ffmpeg/video/vp9_vaapi_10b420.webm
new file mode 100644 (file)
index 0000000..94940c4
--- /dev/null
@@ -0,0 +1,5 @@
+webm vp9_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=p010le
+profile=2
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/vp9_vaapi_8b420.mp4 b/cinelerra-5.1/ffmpeg/video/vp9_vaapi_8b420.mp4
new file mode 100644 (file)
index 0000000..fb6a0f1
--- /dev/null
@@ -0,0 +1,5 @@
+mp4 vp9_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=nv12
+profile=0
+# global_quality=22
diff --git a/cinelerra-5.1/ffmpeg/video/vp9_vaapi_8b420.webm b/cinelerra-5.1/ffmpeg/video/vp9_vaapi_8b420.webm
new file mode 100644 (file)
index 0000000..f727d97
--- /dev/null
@@ -0,0 +1,5 @@
+webm vp9_vaapi
+cin_hw_dev=vaapi
+cin_pix_fmt=nv12
+profile=0
+# global_quality=22
diff --git a/cinelerra-5.1/thirdparty/src/mjpegtools-2.2.1.patch9 b/cinelerra-5.1/thirdparty/src/mjpegtools-2.2.1.patch9
new file mode 100644 (file)
index 0000000..a22b38b
--- /dev/null
@@ -0,0 +1,10 @@
+--- ./Makefile.am.orig 2024-10-17 01:30:58.998525349 +0300
++++ ./Makefile.am      2024-10-17 01:31:14.046525338 +0300
+@@ -21,7 +21,6 @@
+       yuvdenoise \
+       yuvfilters \
+       yuvdeinterlace \
+-      y4mdenoise \
+       y4mscaler \
+       y4munsharp \
+         y4mutils