Skip to content

Commit e1ee020

Browse files
committed
core: support CV_16F mixChannels dispatch
OpenCV 4.13 leaves the CV_16F slot unset in the CPU mixChannels dispatch table, so mixChannels, extractChannel, and insertChannel assert for half-float Mats. Lightricks uses CV_16F Mats for Metal half-float textures and tensors, including channel slicing and padding. Route CV_16F through the existing 16-bit copy implementation because mixChannels copies channel storage without interpreting numeric values.
1 parent 3805b11 commit e1ee020

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

modules/core/src/channels.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ static MixChannelsFunc getMixchFunc(int depth)
8383
{
8484
mixChannels8u, mixChannels8u, mixChannels16u,
8585
mixChannels16u, mixChannels32s, mixChannels32s,
86-
mixChannels64s, 0
86+
// Upstream OpenCV leaves the CV_16F slot unset here, so CPU
87+
// mixChannels/extractChannel/insertChannel assert when called on
88+
// half-float Mats. Lightricks uses CV_16F Mats for Metal half-float
89+
// textures and tensors, including channel slicing/padding. mixChannels
90+
// only copies channel storage; it does not interpret numeric values.
91+
// Mapping CV_16F to the 16-bit implementation preserves the exact
92+
// half-float bit pattern while enabling the missing dispatch entry.
93+
mixChannels64s, mixChannels16u
8794
};
8895

8996
return mixchTab[depth];

0 commit comments

Comments
 (0)