// Copyright 2022 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // Colorspace utilities. #include "sharpyuv/sharpyuv_csp.h" #include <assert.h> #include <math.h> #include <stddef.h> static int ToFixed16(float f) { … } void SharpYuvComputeConversionMatrix(const SharpYuvColorSpace* yuv_color_space, SharpYuvConversionMatrix* matrix) { … } // Matrices are in YUV_FIX fixed point precision. // WebP's matrix, similar but not identical to kRec601LimitedMatrix. static const SharpYuvConversionMatrix kWebpMatrix = …; // Kr=0.2990f Kb=0.1140f bits=8 range=kSharpYuvRangeLimited static const SharpYuvConversionMatrix kRec601LimitedMatrix = …; // Kr=0.2990f Kb=0.1140f bits=8 range=kSharpYuvRangeFull static const SharpYuvConversionMatrix kRec601FullMatrix = …; // Kr=0.2126f Kb=0.0722f bits=8 range=kSharpYuvRangeLimited static const SharpYuvConversionMatrix kRec709LimitedMatrix = …; // Kr=0.2126f Kb=0.0722f bits=8 range=kSharpYuvRangeFull static const SharpYuvConversionMatrix kRec709FullMatrix = …; const SharpYuvConversionMatrix* SharpYuvGetConversionMatrix( SharpYuvMatrixType matrix_type) { … }