Skip to content

Commit 0778393

Browse files
committed
Fix HEVC alignment when building with old libva
1 parent 8eaf749 commit 0778393

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

subprojects/packagefiles/hevc1.patch

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
From bcfbf2bac8f9eeeedc407b40596f5c7aaa0d5b47 Mon Sep 17 00:00:00 2001
1+
From db4e92ea9238f0093e0a66c64b00bae2e04cb745 Mon Sep 17 00:00:00 2001
22
From: David Rosca <nowrep@gmail.com>
3-
Date: Tue, 22 Oct 2024 17:26:58 +0200
4-
Subject: [PATCH] lavc/vaapi_encode: Query surface alignment
3+
Date: Sun, 13 Apr 2025 15:02:41 +0200
4+
Subject: [PATCH] vaapi surface alignment
55

6-
It needs to create temporary config to query surface attribute.
7-
8-
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
96
---
10-
libavcodec/vaapi_encode.c | 66 +++++++++++++++++++++++++++++++++++++++
7+
libavcodec/vaapi_encode.c | 62 +++++++++++++++++++++++++++++++++++++++
118
libavcodec/vaapi_encode.h | 4 +++
12-
2 files changed, 70 insertions(+)
9+
2 files changed, 66 insertions(+)
1310

1411
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
15-
index b593d976ef6b6..8960e6b20afa2 100644
12+
index 16a9a36..d825233 100644
1613
--- a/libavcodec/vaapi_encode.c
1714
+++ b/libavcodec/vaapi_encode.c
18-
@@ -1133,6 +1133,68 @@ static av_cold int vaapi_encode_profile_entrypoint(AVCodecContext *avctx)
15+
@@ -1133,6 +1133,64 @@ fail:
1916
return err;
2017
}
2118

2219
+static av_cold int vaapi_encode_surface_alignment(av_unused AVCodecContext *avctx)
2320
+{
24-
+#if VA_CHECK_VERSION(1, 21, 0)
2521
+ VAAPIEncodeContext *ctx = avctx->priv_data;
2622
+ VASurfaceAttrib *attr_list = NULL;
2723
+ unsigned int attr_count = 0;
@@ -63,7 +59,7 @@ index b593d976ef6b6..8960e6b20afa2 100644
6359
+ }
6460
+
6561
+ for (unsigned int i = 0; i < attr_count; i++) {
66-
+ if (attr_list[i].type == VASurfaceAttribAlignmentSize) {
62+
+ if (attr_list[i].type == 10 /*VASurfaceAttribAlignmentSize*/) {
6763
+ ctx->surface_alignment_width =
6864
+ 1 << (attr_list[i].value.value.i & 0xf);
6965
+ ctx->surface_alignment_height =
@@ -76,15 +72,12 @@ index b593d976ef6b6..8960e6b20afa2 100644
7672
+ av_freep(&attr_list);
7773
+ vaDestroyConfig(ctx->hwctx->display, va_config);
7874
+ return err;
79-
+#else
80-
+ return 0;
81-
+#endif
8275
+}
8376
+
8477
static const VAAPIEncodeRCMode vaapi_encode_rc_modes[] = {
8578
// Bitrate Quality
8679
// | Maxrate | HRD/VBV
87-
@@ -2111,6 +2173,10 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
80+
@@ -2111,6 +2169,10 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
8881
if (err < 0)
8982
goto fail;
9083

@@ -96,7 +89,7 @@ index b593d976ef6b6..8960e6b20afa2 100644
9689
err = ctx->codec->get_encoder_caps(avctx);
9790
if (err < 0)
9891
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
99-
index 40a3f4e064e6e..8e3eab9f27722 100644
92+
index c4f8539..ca5cfe9 100644
10093
--- a/libavcodec/vaapi_encode.h
10194
+++ b/libavcodec/vaapi_encode.h
10295
@@ -260,6 +260,10 @@ typedef struct VAAPIEncodeContext {
@@ -110,3 +103,6 @@ index 40a3f4e064e6e..8e3eab9f27722 100644
110103
} VAAPIEncodeContext;
111104

112105
typedef struct VAAPIEncodeType {
106+
--
107+
2.49.0
108+

0 commit comments

Comments
 (0)