From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id A29524F3B5 for ; Tue, 24 Feb 2026 21:42:58 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'PkwQr4I63ob96/0h/ZBmmmIpWMd9vf8YUx8XWoOlvxQ=', expected b'K5P+CYqcn5EMJShjAFoKy5vAwRHDLOzqn3mN5hV4d78=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1771924711; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=PkwQr4I63ob96/0h/ZBmmmIpWMd9vf8YUx8XWoOlvxQ=; b=Y4fY8B28T988OY8uwigNs0nsjmNcJmufuopNtD6cJy5eLzmQCJ7WgI4hhi9xVauuoDcQw Z4CYdQ4JODHqNUZgji3rFgeWKYhC8T/h3Zv0+TMhmgN38mlBB7pjk+xmyUdZ6h5/sfeynpD fMHisJu4XvjkNwuy9mdrPkhzoHSo107e9gxPquR8W4nsYf1U5IhXyOpumFd3VCAgNAi271N /MgU0ZqV6SeG2pnYogYGVL40gWb9LnKzHUD/pnOL9n+o1JXs627hEZunXnCv7dY1SgVgqhr f7EeXwVS/SdjYyrJZLrly3+eroKEgY2WydC5Rv28ZIlXmwab+87Mpx7J6k4Q== Received: from [172.18.0.3] (unknown [172.18.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 717EF691340; Tue, 24 Feb 2026 11:18:31 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1771924697; b=FSEdvKqetbjUlj0ukLLPCTNKZxFRT7c+AZ0aw60XyjRu7q0J45bL+O8dvyKzHMyUG5pA4 zOoJRQ1mdlgnqbVOWEy3/AiIsfMaOsAXGapTPEIcr9ohVfGQdJ8eqKewrDtmiwln+K3ur3k QUa/r47a4IV10j0BL5nB6Jo2WrguVDfCXPmLqLdMkpxUS2jhCLd+/rt0PZ70+FOBhbde6zw BzpDDVdal5M0Vg84b/l+ge5F5jp7gmP2AXo1EhPGwUV3LJei7LPRmZEbc3Pf4tVI9fzb6di 4WIfoUjKVBBpLFOzj3AIz/DYEHKU7dm7fUWvZOa/BjePUafdTBQQAOPA3duw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1771924697; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=+K0WAgb+OrdC+sPLR7QaHGAM8KUQejdsTLAeQWr9+Kw=; b=ri7TwCdWs8WgaCnylSG98VZbnE2ySehyx9VGBMMggHwF6sxWoJapS7obEW7BrASb6uJfh PI83ZG22dnJkKY80HScjvcMH3bBek3cjhopIflnLT15iDpvREGSjY9/8Mky/d/mujuJO08T v5SyylS6qZ3LKeVgs02eGNjuC3EW/HCmb2efC6uEEp1XiqClabfjE9ONo3PwR9u4Ukjn0j6 961mbBpV3AwYjXm+Og5GBlXR+XJyNEGnFNNIyhOvfV3m+nGZmRSkJUplbj4miiXMRsjZcya tzzIpzlsyVEJmTwQAvAF8JFJhUra5JmAwQEeSWwgi1fK1AV/nxANAbiVCaUQ== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1771924688; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=K5P+CYqcn5EMJShjAFoKy5vAwRHDLOzqn3mN5hV4d78=; b=MhGzPidjc30X/WYPxfWuV/NFOiHRdDY2MW6bUfQT/dhwBArqBbEx/YuK5zcbU/QLwunuv hvOWSUA28su/AV+mAzbf5pz+vNkdiUU01mXE2Qa+BhzGIv9ZeEdXzLVJLhOBIyamHkJWzdr bvzOK0isWHM6/TLCE1Hl9+adm08A022InkKvf/ujc/N/sGf56a0rVqz+pjASrLXgFShjReH ErvPEyMcJQrgJmBXnoWYOIQv+6GwPZGcCRE67J5/0ePF1HvZLK1HKTZ0YEiWTJN3x8KDQIY wRW4yB2kY8rXK8wIhMIyDyKo/CH8EjGJYlIXXXKUX1gOPQBdmmuPx3hh/Wdg== MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 24 Feb 2026 09:18:08 -0000 Message-ID: <177192468866.25.9759078573572577669@29965ddac10e> Message-ID-Hash: EIOLP25ZXHMUFTRXJXWV4REAX4M53X5J X-Message-ID-Hash: EIOLP25ZXHMUFTRXJXWV4REAX4M53X5J X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PR] ppc fixes: h264chroma, swscale VSX/MSB, ffvhuff >8bpp (PR #22274) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: jfiusdq via ffmpeg-devel Cc: jfiusdq Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #22274 opened by jfiusdq URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22274 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22274.patch This series fixes several PPC-specific issues that showed up as corrupted output and FATE failures on ppc64le. - Fix h264chroma Altivec coeff splat on little-endian. - Fix VSX yuv2planeX signed accumulation and guard NBPS on MSB formats. - Avoid Altivec bool macro by using _Bool in swscale ops structs. - Fix >8bpp ffvhuff median predictor endianness and update refs. - Add Changelog entries for the fixes. All tests were run with all samples, checkasm, all pass on IBM POWER9 ppc64le. jfiusdq (6): ppc/h264chroma: fix coeff splat on LE ppc/swscale: fix signed accum in vsx yuv2planeX ppc/swscale: avoid nbps vsx on msb formats swscale/ops: use _Bool to avoid altivec bool macro ffvhuff: fix median init for >8bpp Changelog: note PPC/ffvhuff fixes Changelog | 4 ++ libavcodec/huffyuvdec.c | 5 +- libavcodec/huffyuvenc.c | 5 +- libavcodec/ppc/h264chroma_template.c | 40 ++++++-------- libswscale/ops.h | 10 ++-- libswscale/ppc/swscale_vsx.c | 64 +++++++++++----------- tests/ref/vsynth/vsynth1-ffvhuff420p12 | 4 +- tests/ref/vsynth/vsynth2-ffvhuff420p12 | 4 +- tests/ref/vsynth/vsynth3-ffvhuff420p12 | 4 +- tests/ref/vsynth/vsynth_lena-ffvhuff420p12 | 4 +- 10 files changed, 76 insertions(+), 68 deletions(-) -- 2.47.3 >>From 2cdff7895fefba78a7b335f00880f045da96675a Mon Sep 17 00:00:00 2001 From: jfiusdq Date: Sun, 22 Feb 2026 02:07:20 +0100 Subject: [PATCH 1/6] ppc/h264chroma: fix coeff splat on LE On little-endian PPC, vec_ld + VEC_SPLAT16 selects the wrong coefficient lane, so the chroma MC taps use incorrect weights and produce visible artifacts. Load the 16-bit coefficients as scalars and use vec_splats() so the same value is broadcast regardless of endianness. Signed-off-by: jfiusdq --- libavcodec/ppc/h264chroma_template.c | 40 +++++++++++++--------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/libavcodec/ppc/h264chroma_template.c b/libavcodec/ppc/h264chroma_template.c index c64856bb14..25c446a048 100644 --- a/libavcodec/ppc/h264chroma_template.c +++ b/libavcodec/ppc/h264chroma_template.c @@ -113,19 +113,17 @@ static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, const uint8_t * src, ptrdiff_t stride, int h, int x, int y) { - DECLARE_ALIGNED(16, signed int, ABCD)[4] = - {((8 - x) * (8 - y)), - (( x) * (8 - y)), - ((8 - x) * ( y)), - (( x) * ( y))}; + const int a = (8 - x) * (8 - y); + const int b = x * (8 - y); + const int c = (8 - x) * y; + const int d = x * y; register int i; vec_u8 fperm; LOAD_ZERO; - const vec_s32 vABCD = vec_ld(0, ABCD); - const vec_s16 vA = VEC_SPLAT16(vABCD, 1); - const vec_s16 vB = VEC_SPLAT16(vABCD, 3); - const vec_s16 vC = VEC_SPLAT16(vABCD, 5); - const vec_s16 vD = VEC_SPLAT16(vABCD, 7); + const vec_s16 vA = vec_splats((signed short)a); + const vec_s16 vB = vec_splats((signed short)b); + const vec_s16 vC = vec_splats((signed short)c); + const vec_s16 vD = vec_splats((signed short)d); const vec_s16 v32ss = vec_sl(vec_splat_s16(1),vec_splat_u16(5)); const vec_u16 v6us = vec_splat_u16(6); @@ -159,14 +157,14 @@ static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, const uint8_t * src, vsrc0ssH = (vec_s16)VEC_MERGEH(zero_u8v,(vec_u8)vsrc0uc); vsrc1ssH = (vec_s16)VEC_MERGEH(zero_u8v,(vec_u8)vsrc1uc); - if (ABCD[3]) { + if (d) { for (i = 0 ; i < h ; i++) { GET_VSRC(vsrc2uc, vsrc3uc, stride, 16, vsrcperm0, vsrcperm1, src); CHROMA_MC8_ALTIVEC_CORE(v32ss, noop); } } else { const vec_s16 vE = vec_add(vB, vC); - if (ABCD[2]) { // x == 0 B == 0 + if (c) { // x == 0 B == 0 for (i = 0 ; i < h ; i++) { GET_VSRC1(vsrc1uc, stride, 15, vsrcperm0, src); CHROMA_MC8_ALTIVEC_CORE_SIMPLE; @@ -188,19 +186,17 @@ static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t *dst, const uint8_t *sr ptrdiff_t stride, int h, int x, int y) { - DECLARE_ALIGNED(16, signed int, ABCD)[4] = - {((8 - x) * (8 - y)), - (( x) * (8 - y)), - ((8 - x) * ( y)), - (( x) * ( y))}; + const int a = (8 - x) * (8 - y); + const int b = x * (8 - y); + const int c = (8 - x) * y; + const int d = x * y; register int i; vec_u8 fperm; LOAD_ZERO; - const vec_s32 vABCD = vec_ld(0, ABCD); - const vec_s16 vA = VEC_SPLAT16(vABCD, 1); - const vec_s16 vB = VEC_SPLAT16(vABCD, 3); - const vec_s16 vC = VEC_SPLAT16(vABCD, 5); - const vec_s16 vD = VEC_SPLAT16(vABCD, 7); + const vec_s16 vA = vec_splats((signed short)a); + const vec_s16 vB = vec_splats((signed short)b); + const vec_s16 vC = vec_splats((signed short)c); + const vec_s16 vD = vec_splats((signed short)d); const vec_s16 v28ss = vec_sub(vec_sl(vec_splat_s16(1),vec_splat_u16(5)),vec_splat_s16(4)); const vec_u16 v6us = vec_splat_u16(6); -- 2.52.0 >>From 4ce3958db2b79ca1744432b27cc7dec60f9906ab Mon Sep 17 00:00:00 2001 From: jfiusdq Date: Sun, 22 Feb 2026 02:07:13 +0100 Subject: [PATCH 2/6] ppc/swscale: fix signed accum in vsx yuv2planeX The VSX yuv2planeX_nbps path accumulates signed products into unsigned vectors, so negative terms wrap and the final pack produces wrong results (seen in swscale floatimg comparisons on ppc64le). Use signed accumulators and vec_packs() for the final 16-bit pack so the arithmetic matches the C reference. Signed-off-by: jfiusdq --- libswscale/ppc/swscale_vsx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libswscale/ppc/swscale_vsx.c b/libswscale/ppc/swscale_vsx.c index c6948546d5..727a273958 100644 --- a/libswscale/ppc/swscale_vsx.c +++ b/libswscale/ppc/swscale_vsx.c @@ -212,7 +212,7 @@ static void yuv2planeX_nbps_vsx(const int16_t *filter, int filterSize, const int add = (1 << (shift - 1)); const int clip = (1 << output_bits) - 1; const uint16_t swap = big_endian ? 8 : 0; - const vec_u32 vadd = (vec_u32) {add, add, add, add}; + const vec_s32 vadd = (vec_s32) {add, add, add, add}; const vec_u32 vshift = (vec_u32) {shift, shift, shift, shift}; const vec_u16 vswap = (vec_u16) {swap, swap, swap, swap, swap, swap, swap, swap}; const vec_u16 vlargest = (vec_u16) {clip, clip, clip, clip, clip, clip, clip, clip}; @@ -220,7 +220,7 @@ static void yuv2planeX_nbps_vsx(const int16_t *filter, int filterSize, const vec_u8 vperm = (vec_u8) {0, 1, 8, 9, 2, 3, 10, 11, 4, 5, 12, 13, 6, 7, 14, 15}; vec_s16 vfilter[MAX_FILTER_SIZE], vin; vec_u16 v; - vec_u32 vleft, vright, vtmp; + vec_s32 vleft, vright, vtmp; int i, j; for (i = 0; i < filterSize; i++) { @@ -235,15 +235,15 @@ static void yuv2planeX_nbps_vsx(const int16_t *filter, int filterSize, for (j = 0; j < filterSize; j++) { vin = vec_vsx_ld(0, &src[j][i]); - vtmp = (vec_u32) vec_mule(vin, vfilter[j]); + vtmp = vec_mule(vin, vfilter[j]); vleft = vec_add(vleft, vtmp); - vtmp = (vec_u32) vec_mulo(vin, vfilter[j]); + vtmp = vec_mulo(vin, vfilter[j]); vright = vec_add(vright, vtmp); } vleft = vec_sra(vleft, vshift); vright = vec_sra(vright, vshift); - v = vec_packsu(vleft, vright); + v = (vec_u16) vec_packs(vleft, vright); v = (vec_u16) vec_max((vec_s16) v, vzero); v = vec_min(v, vlargest); v = vec_rl(v, vswap); -- 2.52.0 >>From bd644ed6b0802cbe85c68c25a9b8983d2263e2da Mon Sep 17 00:00:00 2001 From: jfiusdq Date: Sun, 22 Feb 2026 02:22:13 +0100 Subject: [PATCH 3/6] ppc/swscale: avoid nbps vsx on msb formats The NBPS VSX path assumes LSB-aligned samples. MSB formats store data in the high bits and require different shifting/masking, so using the NBPS path corrupts output. Gate the VSX NBPS implementation for MSB formats to fall back to the existing scalar path. Signed-off-by: jfiusdq --- libswscale/ppc/swscale_vsx.c | 54 +++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/libswscale/ppc/swscale_vsx.c b/libswscale/ppc/swscale_vsx.c index 727a273958..d5b262108f 100644 --- a/libswscale/ppc/swscale_vsx.c +++ b/libswscale/ppc/swscale_vsx.c @@ -2049,36 +2049,38 @@ av_cold void ff_sws_init_swscale_vsx(SwsInternal *c) #endif if (!(c->opts.flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->needAlpha) { - switch (c->dstBpc) { - case 8: - c->yuv2plane1 = yuv2plane1_8_vsx; - break; + if (!isDataInHighBits(dstFormat)) { + switch (c->dstBpc) { + case 8: + c->yuv2plane1 = yuv2plane1_8_vsx; + break; #if !HAVE_BIGENDIAN - case 9: - c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_vsx : yuv2plane1_9LE_vsx; - c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_vsx : yuv2planeX_9LE_vsx; - break; - case 10: - c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_vsx : yuv2plane1_10LE_vsx; - c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_vsx : yuv2planeX_10LE_vsx; - break; - case 12: - c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_vsx : yuv2plane1_12LE_vsx; - c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_vsx : yuv2planeX_12LE_vsx; - break; - case 14: - c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_14BE_vsx : yuv2plane1_14LE_vsx; - c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_14BE_vsx : yuv2planeX_14LE_vsx; - break; - case 16: - c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_vsx : yuv2plane1_16LE_vsx; + case 9: + c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_vsx : yuv2plane1_9LE_vsx; + c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_vsx : yuv2planeX_9LE_vsx; + break; + case 10: + c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_vsx : yuv2plane1_10LE_vsx; + c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_vsx : yuv2planeX_10LE_vsx; + break; + case 12: + c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_vsx : yuv2plane1_12LE_vsx; + c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_vsx : yuv2planeX_12LE_vsx; + break; + case 14: + c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_14BE_vsx : yuv2plane1_14LE_vsx; + c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_14BE_vsx : yuv2planeX_14LE_vsx; + break; + case 16: + c->yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_vsx : yuv2plane1_16LE_vsx; #if HAVE_POWER8 - if (cpu_flags & AV_CPU_FLAG_POWER8) { - c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_vsx : yuv2planeX_16LE_vsx; - } + if (cpu_flags & AV_CPU_FLAG_POWER8) { + c->yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_vsx : yuv2planeX_16LE_vsx; + } #endif /* HAVE_POWER8 */ - break; + break; #endif /* !HAVE_BIGENDIAN */ + } } } -- 2.52.0 >>From 2533aec2cdeb19698577c237526402926827751f Mon Sep 17 00:00:00 2001 From: jfiusdq Date: Sun, 22 Feb 2026 02:53:55 +0100 Subject: [PATCH 4/6] swscale/ops: use _Bool to avoid altivec bool macro util_altivec.h redefines bool to __bool, so when ops.h is included from graph.c the SwsComps/SwsOpList layout changes. ops.c and graph.c then disagree on struct size, leading to heap corruption. Use _Bool in ops.h for fields and prototypes that must be layout-stable, avoiding the macro substitution. Signed-off-by: jfiusdq --- libswscale/ops.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libswscale/ops.h b/libswscale/ops.h index 9f93c12fa8..8f96c1e7d9 100644 --- a/libswscale/ops.h +++ b/libswscale/ops.h @@ -38,7 +38,7 @@ typedef enum SwsPixelType { const char *ff_sws_pixel_type_name(SwsPixelType type); int ff_sws_pixel_type_size(SwsPixelType type) av_const; -bool ff_sws_pixel_type_is_int(SwsPixelType type) av_const; +_Bool ff_sws_pixel_type_is_int(SwsPixelType type) av_const; typedef enum SwsOpType { SWS_OP_INVALID = 0, @@ -88,7 +88,7 @@ static_assert(sizeof(SwsConst) == sizeof(AVRational) * 4, typedef struct SwsComps { unsigned flags[4]; /* knowledge about (output) component contents */ - bool unused[4]; /* which input components are definitely unused */ + _Bool unused[4]; /* which input components are definitely unused */ /* Keeps track of the known possible value range, or {0, 0} for undefined * or (unknown range) floating point inputs */ @@ -98,7 +98,7 @@ typedef struct SwsComps { typedef struct SwsReadWriteOp { uint8_t elems; /* number of elements (of type `op.type`) to read/write */ uint8_t frac; /* fractional pixel step factor (log2) */ - bool packed; /* read multiple elements from a single plane */ + _Bool packed; /* read multiple elements from a single plane */ /** Examples: * rgba = 4x u8 packed @@ -133,7 +133,7 @@ typedef struct SwsSwizzleOp { typedef struct SwsConvertOp { SwsPixelType to; /* type of pixel to convert to */ - bool expand; /* if true, integers are expanded to the full range */ + _Bool expand; /* if true, integers are expanded to the full range */ } SwsConvertOp; typedef struct SwsDitherOp { @@ -253,7 +253,7 @@ SwsOpList *ff_sws_op_list_duplicate(const SwsOpList *ops); * Returns whether an op list represents a true no-op operation, i.e. may be * eliminated entirely from an execution graph. */ -bool ff_sws_op_list_is_noop(const SwsOpList *ops); +_Bool ff_sws_op_list_is_noop(const SwsOpList *ops); /** * Returns the size of the largest pixel type used in `ops`. -- 2.52.0 >>From d98a405005b049121c90cd2e7d50ff4dc454e0ae Mon Sep 17 00:00:00 2001 From: jfiusdq Date: Sun, 22 Feb 2026 03:19:22 +0100 Subject: [PATCH 5/6] ffvhuff: fix median init for >8bpp The median predictor initialization used p->data[plane][0], which only reads the low byte of 16-bit samples. For >8bpp formats that made the initial predictor value endian-dependent and produced different bitstreams on big vs little endian. Read the full 16-bit sample when bps > 8 in both encoder and decoder, then update the ffvhuff420p12 vsynth references to match the corrected, endian-neutral output. Signed-off-by: jfiusdq --- libavcodec/huffyuvdec.c | 5 ++++- libavcodec/huffyuvenc.c | 5 ++++- tests/ref/vsynth/vsynth1-ffvhuff420p12 | 4 ++-- tests/ref/vsynth/vsynth2-ffvhuff420p12 | 4 ++-- tests/ref/vsynth/vsynth3-ffvhuff420p12 | 4 ++-- tests/ref/vsynth/vsynth_lena-ffvhuff420p12 | 4 ++-- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index c98904d497..7b79ee7754 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -987,7 +987,10 @@ static int decode_slice(AVCodecContext *avctx, AVFrame *p, int height, break; } - lefttop = p->data[plane][0]; + if (s->bps <= 8) + lefttop = p->data[plane][0]; + else + lefttop = ((const uint16_t *)p->data[plane])[0]; decode_plane_bitstream(s, w, plane); add_median_prediction(s, p->data[plane] + fake_stride, p->data[plane], s->temp[0], w, &left, &lefttop); y++; diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index b213d4dc95..aa3de97e39 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -909,7 +909,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, y++; } - lefttop = p->data[plane][0]; + if (s->bps <= 8) + lefttop = p->data[plane][0]; + else + lefttop = ((const uint16_t *)p->data[plane])[0]; for (; y < h; y++) { const uint8_t *dst = p->data[plane] + p->linesize[plane] * y; diff --git a/tests/ref/vsynth/vsynth1-ffvhuff420p12 b/tests/ref/vsynth/vsynth1-ffvhuff420p12 index 72ff82c006..1a967dad75 100644 --- a/tests/ref/vsynth/vsynth1-ffvhuff420p12 +++ b/tests/ref/vsynth/vsynth1-ffvhuff420p12 @@ -1,4 +1,4 @@ -6210a990bd25c2dcbc72beafe1f806e2 *tests/data/fate/vsynth1-ffvhuff420p12.avi -12961816 tests/data/fate/vsynth1-ffvhuff420p12.avi +3691cf99f8055b31ceb0be79e7637803 *tests/data/fate/vsynth1-ffvhuff420p12.avi +12961884 tests/data/fate/vsynth1-ffvhuff420p12.avi c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-ffvhuff420p12.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-ffvhuff420p12 b/tests/ref/vsynth/vsynth2-ffvhuff420p12 index 328f05fd38..d14f07da88 100644 --- a/tests/ref/vsynth/vsynth2-ffvhuff420p12 +++ b/tests/ref/vsynth/vsynth2-ffvhuff420p12 @@ -1,4 +1,4 @@ -29460ef3dd44f72e5f4e90316ac798b8 *tests/data/fate/vsynth2-ffvhuff420p12.avi -9977204 tests/data/fate/vsynth2-ffvhuff420p12.avi +6bb029f07150008ac655787d350d811a *tests/data/fate/vsynth2-ffvhuff420p12.avi +9977276 tests/data/fate/vsynth2-ffvhuff420p12.avi 36d7ca943916e1743cefa609eba0205c *tests/data/fate/vsynth2-ffvhuff420p12.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth3-ffvhuff420p12 b/tests/ref/vsynth/vsynth3-ffvhuff420p12 index 19290b7ffb..b82dd3c077 100644 --- a/tests/ref/vsynth/vsynth3-ffvhuff420p12 +++ b/tests/ref/vsynth/vsynth3-ffvhuff420p12 @@ -1,4 +1,4 @@ -592f3643ba063499c1c477765c08f630 *tests/data/fate/vsynth3-ffvhuff420p12.avi -161128 tests/data/fate/vsynth3-ffvhuff420p12.avi +e39b27c7461eedb0c222746a6b133714 *tests/data/fate/vsynth3-ffvhuff420p12.avi +161152 tests/data/fate/vsynth3-ffvhuff420p12.avi a038ad7c3c09f776304ef7accdea9c74 *tests/data/fate/vsynth3-ffvhuff420p12.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 86700/ 86700 diff --git a/tests/ref/vsynth/vsynth_lena-ffvhuff420p12 b/tests/ref/vsynth/vsynth_lena-ffvhuff420p12 index 96ab396c26..9e908d44c2 100644 --- a/tests/ref/vsynth/vsynth_lena-ffvhuff420p12 +++ b/tests/ref/vsynth/vsynth_lena-ffvhuff420p12 @@ -1,4 +1,4 @@ -0930b3d622b78d3c13e80222f95b0be2 *tests/data/fate/vsynth_lena-ffvhuff420p12.avi -9901820 tests/data/fate/vsynth_lena-ffvhuff420p12.avi +26018d57e1fa92ef04857e40e8a7e36a *tests/data/fate/vsynth_lena-ffvhuff420p12.avi +9901856 tests/data/fate/vsynth_lena-ffvhuff420p12.avi dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth_lena-ffvhuff420p12.out.rawvideo stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200 -- 2.52.0 >>From 86fb89c90ab2bbb120b1a096f7ba5719cd1bf118 Mon Sep 17 00:00:00 2001 From: jfiusdq Date: Sun, 22 Feb 2026 03:35:49 +0100 Subject: [PATCH 6/6] Changelog: note PPC/ffvhuff fixes Document the recent PPC-related fixes and the ffvhuff >8bpp\nendianness correction in the release notes. Signed-off-by: jfiusdq --- Changelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Changelog b/Changelog index f1e10080c6..e23c9df359 100644 --- a/Changelog +++ b/Changelog @@ -22,6 +22,10 @@ version : - Add vf_mestimate_d3d12 filter - xHE-AAC Mps212 decoding support (experimental) - Remove the old HLS protocol handler +- ppc/h264chroma: fix Altivec coeff splat on little-endian +- ppc/swscale: fix VSX yuv2planeX accumulation and MSB handling +- swscale/ops: avoid altivec bool macro struct layout mismatch +- ffvhuff: fix >8bpp median predictor endianness version 8.0: -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org