Compute the number of data frames before calling the process function.