Backport a patch to fix the missing symbol in libswscale.so.10 . Without
it the libswscale.so.10 file cannot be used at runtime due to a missing
ff_sws_chroma_pos symbol. This is cased by the implementation of this
function being guarded behind a CONFIG_UNSTABLE macro guard, but the
definition and usage don't use this guard. Therefore the implementation
is missing when building without CONFIG_UNSTABLE resulting in the
library not being able to be loaded.

Fixes: 0624017a6b57 ("ffmpeg: version bump 8.0 -> 9.0.2")
Signed-off-by: Sven Püschel <[email protected]>
---
 ...uild-ff_sws_chroma_pos-even-without-.patch | 113 ++++++++++++++++++
 patches/ffmpeg-9.0.2/series                   |   4 +
 2 files changed, 117 insertions(+)
 create mode 100644 
patches/ffmpeg-9.0.2/0001-swscale-format-Build-ff_sws_chroma_pos-even-without-.patch
 create mode 100644 patches/ffmpeg-9.0.2/series

diff --git 
a/patches/ffmpeg-9.0.2/0001-swscale-format-Build-ff_sws_chroma_pos-even-without-.patch
 
b/patches/ffmpeg-9.0.2/0001-swscale-format-Build-ff_sws_chroma_pos-even-without-.patch
new file mode 100644
index 000000000..7c2daca40
--- /dev/null
+++ 
b/patches/ffmpeg-9.0.2/0001-swscale-format-Build-ff_sws_chroma_pos-even-without-.patch
@@ -0,0 +1,113 @@
+From: Andreas Rheinhardt <[email protected]>
+Date: Tue, 30 Jun 2026 21:44:27 +0200
+Subject: [PATCH] swscale/format: Build ff_sws_chroma_pos() even without
+ CONFIG_UNSTABLE
+
+It is used in add_legacy_sws_pass() in graph.c.
+
+Signed-off-by: Andreas Rheinhardt <[email protected]>
+Upstream-Status: Backport [fad1db043d45d4d3cc482934ac6cd579f556a6e8]
+---
+ libswscale/format.c | 82 ++++++++++++++++++++++++++---------------------------
+ 1 file changed, 41 insertions(+), 41 deletions(-)
+
+diff --git a/libswscale/format.c b/libswscale/format.c
+index b03cfff44aa7..70cc813dd767 100644
+--- a/libswscale/format.c
++++ b/libswscale/format.c
+@@ -551,6 +551,47 @@ bool ff_infer_colors(SwsColor *src, SwsColor *dst)
+     return incomplete;
+ }
+ 
++void ff_sws_chroma_pos(const SwsFormat *fmt, bool *incomplete,
++                       int *out_x_pos, int *out_y_pos)
++{
++    enum AVChromaLocation chroma_loc = fmt->loc;
++    const int sub_x = fmt->desc->log2_chroma_w;
++    const int sub_y = fmt->desc->log2_chroma_h;
++    int x_pos, y_pos;
++
++    /* Explicitly default to center siting for compatibility with swscale */
++    if (chroma_loc == AVCHROMA_LOC_UNSPECIFIED) {
++        chroma_loc = AVCHROMA_LOC_CENTER;
++        *incomplete |= sub_x || sub_y;
++    }
++
++    /* av_chroma_location_enum_to_pos() always gives us values in the range 
from
++     * 0 to 256, but we need to adjust this to the true value range of the
++     * subsampling grid, which may be larger for h/v_sub > 1 */
++    av_chroma_location_enum_to_pos(&x_pos, &y_pos, chroma_loc);
++    x_pos *= (1 << sub_x) - 1;
++    y_pos *= (1 << sub_y) - 1;
++
++    /* Fix vertical chroma position for interlaced frames */
++    if (sub_y && fmt->interlaced) {
++        /* When vertically subsampling, chroma samples are effectively only
++         * placed next to even rows. To access them from the odd field, we 
need
++         * to account for this shift by offsetting the distance of one luma 
row.
++         *
++         * For 4x vertical subsampling (v_sub == 2), they are only placed
++         * next to every *other* even row, so we need to shift by three luma
++         * rows to get to the chroma sample. */
++        if (fmt->field == FIELD_BOTTOM)
++            y_pos += (256 << sub_y) - 256;
++
++        /* Luma row distance is doubled for fields, so halve offsets */
++        y_pos >>= 1;
++    }
++
++    *out_x_pos = x_pos;
++    *out_y_pos = y_pos;
++}
++
+ /* Variant of sws_test_format() for the ops-based code */
+ static int test_format_ops(enum AVPixelFormat format, int output);
+ static int test_format_legacy(enum AVPixelFormat format, int output)
+@@ -1434,47 +1475,6 @@ linear_mat3(const AVRational m00, const AVRational m01, 
const AVRational m02,
+     return c;
+ }
+ 
+-void ff_sws_chroma_pos(const SwsFormat *fmt, bool *incomplete,
+-                       int *out_x_pos, int *out_y_pos)
+-{
+-    enum AVChromaLocation chroma_loc = fmt->loc;
+-    const int sub_x = fmt->desc->log2_chroma_w;
+-    const int sub_y = fmt->desc->log2_chroma_h;
+-    int x_pos, y_pos;
+-
+-    /* Explicitly default to center siting for compatibility with swscale */
+-    if (chroma_loc == AVCHROMA_LOC_UNSPECIFIED) {
+-        chroma_loc = AVCHROMA_LOC_CENTER;
+-        *incomplete |= sub_x || sub_y;
+-    }
+-
+-    /* av_chroma_location_enum_to_pos() always gives us values in the range 
from
+-     * 0 to 256, but we need to adjust this to the true value range of the
+-     * subsampling grid, which may be larger for h/v_sub > 1 */
+-    av_chroma_location_enum_to_pos(&x_pos, &y_pos, chroma_loc);
+-    x_pos *= (1 << sub_x) - 1;
+-    y_pos *= (1 << sub_y) - 1;
+-
+-    /* Fix vertical chroma position for interlaced frames */
+-    if (sub_y && fmt->interlaced) {
+-        /* When vertically subsampling, chroma samples are effectively only
+-         * placed next to even rows. To access them from the odd field, we 
need
+-         * to account for this shift by offsetting the distance of one luma 
row.
+-         *
+-         * For 4x vertical subsampling (v_sub == 2), they are only placed
+-         * next to every *other* even row, so we need to shift by three luma
+-         * rows to get to the chroma sample. */
+-        if (fmt->field == FIELD_BOTTOM)
+-            y_pos += (256 << sub_y) - 256;
+-
+-        /* Luma row distance is doubled for fields, so halve offsets */
+-        y_pos >>= 1;
+-    }
+-
+-    *out_x_pos = x_pos;
+-    *out_y_pos = y_pos;
+-}
+-
+ int ff_sws_decode_colors(SwsContext *ctx, SwsPixelType type,
+                          SwsOpList *ops, const SwsFormat *fmt, bool 
*incomplete)
+ {
diff --git a/patches/ffmpeg-9.0.2/series b/patches/ffmpeg-9.0.2/series
new file mode 100644
index 000000000..ff268ecd1
--- /dev/null
+++ b/patches/ffmpeg-9.0.2/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-swscale-format-Build-ff_sws_chroma_pos-even-without-.patch
+# 3d2e6d30725921cf2abc010a75daa5a7  - git-ptx-patches magic
-- 
2.47.3


Reply via email to