Assuming I have a 2-dimension std::vector object representing a multi-channel data buffer.
std::vector<std::vector<int>> buffer = (2, std::vector<int>(512));
I would like to design a convolution filter function which takes a 2-D sliced data buffer as input. For example each slice is of size (2, 16).
/**
* This is my current design.
* I have to copy part of
* my original buffer and return
* a 2-D vector which I don't like
*/
std::vector<std::vector<int> convolve(std::vector<std::vector<int>> &sliceOfBuffer);
/**
* I am looking for something similar to this
*/
void convolve(std::vector<std::vector<int>> &sliceOfBuffer);
For 1-D vector I can use 2 iterator to achieve the vector slicing. Is there any efficient way for 2-D vector as well?
Aucun commentaire:
Enregistrer un commentaire