| 224 | |
| 225 | |
| 226 | py::array_t<int> segment_index_clean(py::array_t<int> seg_idx) { |
| 227 | // input array |
| 228 | py::buffer_info si_buf = seg_idx.request(); |
| 229 | int *si_ptr = (int *) si_buf.ptr; |
| 230 | int h = si_buf.shape[0]; |
| 231 | int w = si_buf.shape[1]; |
| 232 | |
| 233 | int cur, next, next2; |
| 234 | for (int h_i = 0; h_i < h; h_i++) { |
| 235 | for (int w_i = 0; w_i < w - 2; w_i++){ |
| 236 | cur = si_ptr[h_i * w + w_i]; |
| 237 | next = si_ptr[h_i * w + w_i + 1]; |
| 238 | next2 = si_ptr[h_i * w + w_i + 2]; |
| 239 | if (next2 == cur && next != cur){ |
| 240 | si_ptr[h_i * w + w_i + 1] = cur; |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | return seg_idx; |
| 246 | } |
| 247 | |
| 248 | py::array_t<float> intra_predict(py::array_t<int> seg_idx, py::array_t<float> model_param, py::array_t<float> transform_map) { |
| 249 | // input array |
nothing calls this directly
no outgoing calls
no test coverage detected