| 53 | { |
| 54 | template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type = 0> |
| 55 | void rgb_to_luminance(const RawTensor &src, RawTensor &dst) |
| 56 | { |
| 57 | // Ensure in/out tensors have same image dimensions (independent of element size and number of channels) |
| 58 | ARM_COMPUTE_ERROR_ON_MSG(src.num_elements() != dst.num_elements(), |
| 59 | "Input and output images must have equal dimensions"); |
| 60 | |
| 61 | const size_t num_elements = dst.num_elements(); |
| 62 | |
| 63 | // Currently, input is always RGB888 (3 U8 channels per element). Output can be U8, U16/S16 or U32 |
| 64 | // Note that src.data()[i] returns pointer to first channel of element[i], so RGB values have [0,1,2] offsets |
| 65 | for (size_t i = 0, j = 0; j < num_elements; i += 3, ++j) |
| 66 | { |
| 67 | reinterpret_cast<T *>(dst.data())[j] = |
| 68 | 0.2126f * src.data()[i] + 0.7152f * src.data()[i + 1] + 0.0722f * src.data()[i + 2]; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | void extract_r_from_rgb(const RawTensor &src, RawTensor &dst) |
| 73 | { |
nothing calls this directly
no test coverage detected