matrix.h 1012 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. static float IDENTITY[9] = {
  3. // clang-format off
  4. 1, 0, 0,
  5. 0, 1, 0,
  6. 0, 0, 1,
  7. // clang-format on
  8. };
  9. static float XYZD50_to_D65[] = {
  10. // clang-format off
  11. 0.9555766f, -0.0230393f, 0.0631636f,
  12. -0.0282895f, 1.0099416f, 0.0210077f,
  13. 0.0122982f, -0.0204830f, 1.3299098f
  14. // clang-format on
  15. };
  16. static float XYZD65_to_sRGB[] = {
  17. // clang-format off
  18. 3.2406f, -1.5372f, -0.4986f,
  19. -0.9689f, 1.8758f, 0.0415f,
  20. 0.0557f, -0.2040f, 1.0570f
  21. // clang-format on
  22. };
  23. static float YUV_to_RGB[] = {
  24. // clang-format off
  25. 0.299f, 0.587f, 0.114f,
  26. -0.299f, -0.587f, 0.886f,
  27. 0.701f, -0.597f, -0.114f
  28. // clang-format on
  29. };
  30. void print_matrix(float m[9]);
  31. void multiply_matrices(const float a[9], const float b[9], float out[9]);
  32. void invert_matrix(const float in[9], float out[9]);
  33. void transpose_matrix(const float in[9], float out[9]);