This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit ede8318e9f2f1f1f17f8be5ff4aa7ef7b0e0883e Author: Niklas Haas <[email protected]> AuthorDate: Mon Dec 22 15:01:46 2025 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Wed Dec 24 16:37:22 2025 +0000 swscale/ops: explicitly reset value range after SWS_OP_UNPACK The current logic implicitly pulled the new value range out of SwsComps using ff_sws_apply_op_q(), but this was quite ill-formed and not very robust. In particular, it only worked because of the implicit assumption that the value range was always set to 0b1111...111. This actually poses a serious problem for 32-bit packed formats, whose value range actually does not fit into AVRational. In the past, it only worked because the value would implicitly overflow to -1, which SWS_OP_UNPACK would then correctly extract the bits out from again. In general, it's cleaner (and sufficient) to just explicitly reset the value range on SWS_OP_UNPACK again. --- libswscale/ops.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libswscale/ops.c b/libswscale/ops.c index 2166461b72..0e35004c0d 100644 --- a/libswscale/ops.c +++ b/libswscale/ops.c @@ -236,6 +236,7 @@ void ff_sws_op_list_update_comps(SwsOpList *ops) case SWS_OP_READ: case SWS_OP_LINEAR: case SWS_OP_SWAP_BYTES: + case SWS_OP_UNPACK: break; /* special cases, handled below */ default: memcpy(op->comps.min, prev.min, sizeof(prev.min)); @@ -302,9 +303,13 @@ void ff_sws_op_list_update_comps(SwsOpList *ops) break; case SWS_OP_UNPACK: for (int i = 0; i < 4; i++) { - if (op->pack.pattern[i]) + const int pattern = op->pack.pattern[i]; + if (pattern) { + av_assert1(pattern < 32); op->comps.flags[i] = prev.flags[0]; - else + op->comps.min[i] = Q(0); + op->comps.max[i] = Q((1ULL << pattern) - 1); + } else op->comps.flags[i] = SWS_COMP_GARBAGE; } break; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
