NUM_CCW
if (sg_len + idx > NUM_CCW) {
sg_len, NUM_CCW);
if (num_periods > NUM_CCW) {
num_periods, NUM_CCW);