HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //usr/include/webp/sharpyuv/sharpyuv_csp.h
// 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.

#ifndef WEBP_SHARPYUV_SHARPYUV_CSP_H_
#define WEBP_SHARPYUV_SHARPYUV_CSP_H_

#include "sharpyuv/sharpyuv.h"

#ifdef __cplusplus
extern "C" {
#endif

// Range of YUV values.
typedef enum {
  kSharpYuvRangeFull,     // YUV values between [0;255] (for 8 bit)
  kSharpYuvRangeLimited   // Y in [16;235], YUV in [16;240] (for 8 bit)
} SharpYuvRange;

// Constants that define a YUV color space.
typedef struct {
  // Kr and Kb are defined such that:
  // Y = Kr * r + Kg * g + Kb * b where Kg = 1 - Kr - Kb.
  float kr;
  float kb;
  int bit_depth;  // 8, 10 or 12
  SharpYuvRange range;
} SharpYuvColorSpace;

// Fills in 'matrix' for the given YUVColorSpace.
SHARPYUV_EXTERN void SharpYuvComputeConversionMatrix(
    const SharpYuvColorSpace* yuv_color_space,
    SharpYuvConversionMatrix* matrix);

// Enums for precomputed conversion matrices.
typedef enum {
  kSharpYuvMatrixWebp = 0,
  kSharpYuvMatrixRec601Limited,
  kSharpYuvMatrixRec601Full,
  kSharpYuvMatrixRec709Limited,
  kSharpYuvMatrixRec709Full,
  kSharpYuvMatrixNum
} SharpYuvMatrixType;

// Returns a pointer to a matrix for one of the predefined colorspaces.
SHARPYUV_EXTERN const SharpYuvConversionMatrix* SharpYuvGetConversionMatrix(
    SharpYuvMatrixType matrix_type);

#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // WEBP_SHARPYUV_SHARPYUV_CSP_H_