blob: 91e28e0a3707db9f0a37c1d02d0b921dd01c05fe [file] [log] [blame]
Hamsalekha S8d3d3032015-03-13 21:24:58 +05301/******************************************************************************
2 *
3 * Copyright (C) 2015 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*/
20/**
21*******************************************************************************
22* @file
23* ih264_deblk_tables.c
24*
25* @brief
26* Contains tables used for deblocking
27*
28* @author
29* Ittiam
30*
31* @par List of Tables:
32* - guc_ih264_qp_scale_cr[]
33* - guc_ih264_alpha_table[]
34* - guc_ih264_beta_table[]
35* - guc_ih264_clip_table[][]
36*
37* @remarks
38* None
39*
40*******************************************************************************
41*/
42
43/*****************************************************************************/
44/* File Includes */
45/*****************************************************************************/
46
47/* System include files */
48#include <stdio.h>
49
50/* User include files */
51#include "ih264_typedefs.h"
52#include "ih264_deblk_tables.h"
53
54/*****************************************************************************/
55/* Extern global definitions */
56/*****************************************************************************/
57
58/**
59 ******************************************************************************
60 * @brief alpha & beta tables for deblocking
61 * input : indexA [0-51] & indexB [0-51]
62 * output : alpha & beta
63 *
64 * @remarks Table 8-16 – in H264 Specification,
65 * Derivation of offset dependent threshold variables
66 * alpha and beta from indexA and indexB
67 ******************************************************************************
68 */
69const UWORD8 gu1_ih264_alpha_table[52] =
70{
71 /* indexA :: 0-51 inclusive */
72 0, 0, 0, 0, 0, 0, 0, 0,
73 0, 0, 0, 0, 0, 0, 0, 0,
74 4, 4, 5, 6, 7, 8, 9, 10,
75 12, 13, 15, 17, 20, 22, 25, 28,
76 32, 36, 40, 45, 50, 56, 63, 71,
77 80, 90, 101, 113, 127, 144, 162, 182,
78 203, 226, 255, 255,
79};
80
81const UWORD8 gu1_ih264_beta_table[52] =
82{
83 /* indexB :: 0-51 inclusive */
84 0, 0, 0, 0, 0, 0, 0, 0,
85 0, 0, 0, 0, 0, 0, 0, 0,
86 2, 2, 2, 3, 3, 3, 3, 4,
87 4, 4, 6, 6, 7, 7, 8, 8,
88 9, 9, 10, 10, 11, 11, 12, 12,
89 13, 13, 14, 14, 15, 15, 16, 16,
90 17, 17, 18, 18,
91};
92
93/**
94 ******************************************************************************
95 * @brief t'C0 table for deblocking
96 * input : indexA [0-51] and bS [1,3]
97 * output : t'C0
98 *
99 * @remarks Table 8-17 – in H264 Specification,
100 * Value of variable t'C0 as a function of indexA and bS
101 ******************************************************************************
102 */
103const UWORD8 gu1_ih264_clip_table[52][4] =
104{
105 /* indexA :: 0-51 inclusive */
106 { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0},
107 { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0},
108 { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0},
109 { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0},
110 { 0, 0, 0, 0}, { 0, 0, 0, 1}, { 0, 0, 0, 1}, { 0, 0, 0, 1},
111 { 0, 0, 0, 1}, { 0, 0, 1, 1}, { 0, 0, 1, 1}, { 0, 1, 1, 1},
112 { 0, 1, 1, 1}, { 0, 1, 1, 1}, { 0, 1, 1, 1}, { 0, 1, 1, 2},
113 { 0, 1, 1, 2}, { 0, 1, 1, 2}, { 0, 1, 1, 2}, { 0, 1, 2, 3},
114 { 0, 1, 2, 3}, { 0, 2, 2, 3}, { 0, 2, 2, 4}, { 0, 2, 3, 4},
115 { 0, 2, 3, 4}, { 0, 3, 3, 5}, { 0, 3, 4, 6}, { 0, 3, 4, 6},
116 { 0, 4, 5, 7}, { 0, 4, 5, 8}, { 0, 4, 6, 9}, { 0, 5, 7,10},
117 { 0, 6, 8,11}, { 0, 6, 8,13}, { 0, 7,10,14}, { 0, 8,11,16},
118 { 0, 9,12,18}, { 0,10,13,20}, { 0,11,15,23}, { 0,13,17,25},
119};