xref: /aosp_15_r20/external/webp/extras/sharpyuv_risk_table.h (revision b2055c353e87c8814eb2b6b1b11112a1562253bd)
1*b2055c35SXin Li // Copyright 2023 Google Inc. All Rights Reserved.
2*b2055c35SXin Li //
3*b2055c35SXin Li // Use of this source code is governed by a BSD-style license
4*b2055c35SXin Li // that can be found in the COPYING file in the root of the source
5*b2055c35SXin Li // tree. An additional intellectual property rights grant can be found
6*b2055c35SXin Li // in the file PATENTS. All contributing project authors may
7*b2055c35SXin Li // be found in the AUTHORS file in the root of the source tree.
8*b2055c35SXin Li // -----------------------------------------------------------------------------
9*b2055c35SXin Li //
10*b2055c35SXin Li // Precomputed data for 420 risk estimation.
11*b2055c35SXin Li 
12*b2055c35SXin Li #ifndef WEBP_EXTRAS_SHARPYUV_RISK_TABLE_H_
13*b2055c35SXin Li #define WEBP_EXTRAS_SHARPYUV_RISK_TABLE_H_
14*b2055c35SXin Li 
15*b2055c35SXin Li #include "src/webp/types.h"
16*b2055c35SXin Li 
17*b2055c35SXin Li extern const int kSharpYuvPrecomputedRiskYuvSampling;
18*b2055c35SXin Li // Table of precomputed risk scores when chroma subsampling images with two
19*b2055c35SXin Li // given colors.
20*b2055c35SXin Li // Since precomputing values for all possible YUV colors would create a huge
21*b2055c35SXin Li // table, the YUV space (i.e. [0, 255]^3) is reduced to
22*b2055c35SXin Li // [0, kSharpYuvPrecomputedRiskYuvSampling-1]^3
23*b2055c35SXin Li // where 255 maps to kSharpYuvPrecomputedRiskYuvSampling-1.
24*b2055c35SXin Li // Table size: kSharpYuvPrecomputedRiskYuvSampling^6 bytes or 114 KiB
25*b2055c35SXin Li extern const uint8_t kSharpYuvPrecomputedRisk[];
26*b2055c35SXin Li 
27*b2055c35SXin Li #endif  // WEBP_EXTRAS_SHARPYUV_RISK_TABLE_H_
28