basisu_ssim.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // basisu_ssim.h
  2. // Copyright (C) 2019 Binomial LLC. All Rights Reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #pragma once
  16. #include "basisu_enc.h"
  17. namespace basisu
  18. {
  19. float gauss(int x, int y, float sigma_sqr);
  20. enum
  21. {
  22. cComputeGaussianFlagNormalize = 1,
  23. cComputeGaussianFlagPrint = 2,
  24. cComputeGaussianFlagNormalizeCenterToOne = 4
  25. };
  26. void compute_gaussian_kernel(float *pDst, int size_x, int size_y, float sigma_sqr, uint32_t flags = 0);
  27. void scale_image(const imagef &src, imagef &dst, const vec4F &scale, const vec4F &shift);
  28. void add_weighted_image(const imagef &src1, const vec4F &alpha, const imagef &src2, const vec4F &beta, const vec4F &gamma, imagef &dst);
  29. void add_image(const imagef &src1, const imagef &src2, imagef &dst);
  30. void adds_image(const imagef &src, const vec4F &value, imagef &dst);
  31. void mul_image(const imagef &src1, const imagef &src2, imagef &dst, const vec4F &scale);
  32. void div_image(const imagef &src1, const imagef &src2, imagef &dst, const vec4F &scale);
  33. vec4F avg_image(const imagef &src);
  34. void gaussian_filter(imagef &dst, const imagef &orig_img, uint32_t odd_filter_width, float sigma_sqr, bool wrapping = false, uint32_t width_divisor = 1, uint32_t height_divisor = 1);
  35. vec4F compute_ssim(const imagef &a, const imagef &b);
  36. vec4F compute_ssim(const image &a, const image &b, bool luma, bool luma_601);
  37. } // namespace basisu