Home | History | Annotate | Download | only in common
      1 /******************************************************************************
      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_trans_data.h
     24  *
     25  * @brief
     26  *  Contains declaration of global variables for H264 transform , qnat and inverse quant
     27  *
     28  * @author
     29  *  Ittiam
     30  *
     31  * @remarks
     32  *
     33  *******************************************************************************
     34  */
     35 #ifndef IH264_GLOBAL_DATA_H_
     36 #define IH264_GLOBAL_DATA_H_
     37 
     38 /*****************************************************************************/
     39 /* Extern global declarations                                                */
     40 /*****************************************************************************/
     41 
     42 /* Scaling matrices for h264 quantization */
     43 extern const UWORD16 g_scal_coff_h264_4x4[16];
     44 extern const UWORD16 g_scal_coff_h264_8x8[16];
     45 
     46 
     47 /**
     48  ******************************************************************************
     49  * @brief  Scale Table for quantizing 4x4 subblock. To quantize a given 4x4 DCT
     50  * transformed block, the coefficient at index location (i,j) is scaled by one of
     51  * the constants in this table and right shift the result by (QP_BITS_h264_4x4 +
     52  * floor(qp/6)), here qp is the quantization parameter used to quantize the mb.
     53  *
     54  * input   : qp%6, index location (i,j)
     55  * output  : scale constant.
     56  *
     57  * @remarks 16 constants for each index position of the subblock and 6 for each
     58  * qp%6 in the range 0-5 inclusive.
     59  ******************************************************************************
     60  */
     61 extern const UWORD16 gu2_quant_scale_matrix_4x4[96];
     62 
     63 /**
     64  ******************************************************************************
     65  * @brief  Round Factor for quantizing subblock. While quantizing a given 4x4 DCT
     66  * transformed block, the coefficient at index location (i,j) is scaled by one of
     67  * the constants in the table gu2_forward_quant_scalar_4x4 and then right shift
     68  * the result by (QP_BITS_h264_4x4 + floor(qp/6)).
     69  * Before right shifting a round factor is added.
     70  * The round factor can be any value [a * (1 << (QP_BITS_h264_4x4 + floor(qp/6)))]
     71  * for 'a' lies in the range 0-0.5.
     72  * Here qp is the quantization parameter used to quantize the mb.
     73  *
     74  * input   : qp/6
     75  * output  : round factor.
     76  *
     77  * @remarks The round factor is constructed by setting a = 1/3
     78  ******************************************************************************
     79  */
     80 extern const UWORD32 gu4_forward_quant_round_factor_4x4[9];
     81 
     82 /**
     83  ******************************************************************************
     84  * @brief  Threshold Table. Quantizing the given DCT coefficient is done only if
     85  * it exceeds the threshold value presented in this table.
     86  *
     87  * input   : qp/6, qp%6, index location (i,j)
     88  * output  : Threshold constant.
     89  *
     90  * @remarks 16 constants for each index position of the subblock and 6 for each
     91  * qp%6 in the range 0-5 inclusive and 9 for each qp/6 in the range 0-51.
     92  ******************************************************************************
     93  */
     94 extern const UWORD16 gu2_forward_quant_threshold_4x4[96];
     95 
     96 /**
     97  ******************************************************************************
     98  * @brief  Scale Table for quantizing 8x8 subblock. To quantize a given 8x8 DCT
     99  * transformed block, the coefficient at index location (i,j) is scaled by one of
    100  * the constants in this table and right shift the result by (QP_BITS_h264_8x8 +
    101  * floor(qp/6)), here qp is the quantization parameter used to quantize the mb.
    102  *
    103  * input   : qp%6, index location (i,j)
    104  * output  : scale constant.
    105  *
    106  * @remarks 64 constants for each index position of the subblock and 6 for each
    107  * qp%6 in the range 0-5 inclusive.
    108  ******************************************************************************
    109  */
    110 extern const UWORD16 gu2_quant_scale_matrix_8x8 [384];
    111 
    112 /**
    113  ******************************************************************************
    114  * @brief  Specification of QPc as a function of qPi
    115  *
    116  * input   : qp luma
    117  * output  : qp chroma.
    118  *
    119  * @remarks Refer Table 8-15 of h264 specification.
    120  ******************************************************************************
    121  */
    122 extern const UWORD8 gu1_qpc_fqpi[52];
    123 
    124 
    125 #endif /* IH264_GLOBAL_DATA_H_ */
    126