Skip to content

Instantly share code, notes, and snippets.

@AkiSakurai
AkiSakurai / ssd-dft.cpp
Created September 10, 2025 00:40 — forked from chengluyu/ssd-dft.cpp
Fast template match using DFT.
#include <cstdint>
#include <iostream>
#include <opencv2/opencv.hpp>
#define TEST_FILE(x) "../" x
template <typename Num>
inline Num sq(Num x) { return x * x; }
cv::Mat convolveDFT(const cv::Mat &image, const cv::Mat &stencil) {

This is an excerpt from our internal documentation describing an issue with drawing in NSViews on macOS Big Sur.

1️⃣ Introduction

In macOS Big Sur (probably starting with β9), Apple changed the default contents format for backing layers of NSViews. Instead of an explicit CALayerContentsFormat.RGBA8Uint value, an „Automatic“ value is now used. Even though it also resolves into „RGBA8“ in our testing, it has some serious implications as it breaks assumptions our code relies on.

I first stumbled upon this issue in this tweet by Frank. It links to a thread on Apple Forums by Mark that contains valuable information as well as ideas for workarounds. The changed behavior was also confirmed by Marcin in this tweet.

2️⃣ Impact on Diagrams