in Transform360/Library/VideoFrameTransform.cpp [340:386]
void VideoFrameTransform::generateKernelsAndFilteringConfigs(
int startTop,
int startBottom,
float sigmaY,
const Mat& kernelY,
int baseSegmentHeight,
int inputWidth,
int inputHeight,
int transformMatPlaneIndex) {
// Top half
// "bottom" is used to calculate the position of a vertical segment
for (int bottom = startBottom; bottom >= 0; bottom -= baseSegmentHeight) {
int top = max(bottom - baseSegmentHeight + 1, 0);
// Here, both "top" and "bottom" are small than 0.5 * inputHeight.
// The "angle", or "distance" of the center, of the segment to equator is
// equal to 0.5 * inputHeight - 0.5 * (top + bottom)
float angle = 0.5 * M_PI * (inputHeight - top - bottom) / inputHeight;
generateKernelAndFilteringConfig(
top,
bottom,
angle,
sigmaY,
kernelY,
inputWidth,
inputHeight,
transformMatPlaneIndex);
}
// Bottom half
// "top" is used to calculate the position of a vertical segment
for (int top = startTop; top < inputHeight; top += baseSegmentHeight) {
int bottom = min(top + baseSegmentHeight - 1, inputHeight - 1);
// Here, both "top" and "bottom" are larger than or equal to
// 0.5 * inputHeight. The "angle" of the segment is equal to
// 0.5 * (top + bottom) - 0.5 * inputHeight
float angle = 0.5 * M_PI * (top + bottom - inputHeight) / inputHeight;
generateKernelAndFilteringConfig(
top,
bottom,
angle,
sigmaY,
kernelY,
inputWidth,
inputHeight,
transformMatPlaneIndex);
}
}