Path: blob/master/thirdparty/basis_universal/encoder/basisu_ssim.h
9902 views
// basisu_ssim.h1// Copyright (C) 2019-2024 Binomial LLC. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14#pragma once15#include "basisu_enc.h"1617namespace basisu18{19float gauss(int x, int y, float sigma_sqr);2021enum22{23cComputeGaussianFlagNormalize = 1,24cComputeGaussianFlagPrint = 2,25cComputeGaussianFlagNormalizeCenterToOne = 426};2728void compute_gaussian_kernel(float *pDst, int size_x, int size_y, float sigma_sqr, uint32_t flags = 0);2930void scale_image(const imagef &src, imagef &dst, const vec4F &scale, const vec4F &shift);31void add_weighted_image(const imagef &src1, const vec4F &alpha, const imagef &src2, const vec4F &beta, const vec4F &gamma, imagef &dst);32void add_image(const imagef &src1, const imagef &src2, imagef &dst);33void adds_image(const imagef &src, const vec4F &value, imagef &dst);34void mul_image(const imagef &src1, const imagef &src2, imagef &dst, const vec4F &scale);35void div_image(const imagef &src1, const imagef &src2, imagef &dst, const vec4F &scale);36vec4F avg_image(const imagef &src);3738void 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);3940vec4F compute_ssim(const imagef &a, const imagef &b);41vec4F compute_ssim(const image &a, const image &b, bool luma, bool luma_601);4243} // namespace basisu444546