xref: /aosp_15_r20/external/libavc/common/ih264_size_defs.h (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
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 *******************************************************************************
23 * @file
24 *  ih264_size_defs.h
25 *
26 * @brief
27 *  Contains macro definitions used in h264 transform, quant and inverse quant
28 *
29 * @author
30 *  ittiam
31 *
32 * @remarks
33 *  none
34 *
35 *******************************************************************************
36 */
37 
38 #ifndef _IH264_SIZE_DEFS_H_
39 #define _IH264_SIZE_DEFS_H_
40 
41 /*****************************************************************************/
42 /* Constant Macros                                                           */
43 /*****************************************************************************/
44 
45 /*-----------------------Primary defs--------------------------*/
46 
47 /*Width of a 4x4 block*/
48 #define SUB_BLK_WIDTH_4x4                   4
49 
50 #define SUB_BLK_HEIGHT_4x4                  4
51 
52 /*Width of an 8x8 block*/
53 #define SUB_BLK_WIDTH_8x8                   8
54 
55 /*Number of chroma blocks in a row of coffs*/
56 #define SUB_BLK_COUNT_CHROMA_4x4_420        2
57 
58 /*Number of luma blocks in a row of coffs*/
59 #define SUB_BLK_COUNT_LUMA_4x4              4
60 
61 /*Numbr of chroma planes*/
62 #define NUM_CHROMA_PLANES                   2
63 
64 /*Constant bit shifts*/
65 #define QP_BITS_h264_4x4                    15
66 #define QP_BITS_h264_8x8                    16
67 
68 
69 /*---------------------------Derived defs------------------------*/
70 
71 /*Number of coefficients ina 4x4 block*/
72 #define COFF_CNT_SUB_BLK_4x4                SUB_BLK_WIDTH_4x4*SUB_BLK_WIDTH_4x4;
73 
74 /*Number of luma blocks in a row of coffs*/
75 #define SUB_BLK_LUMA_4X4_CNT_MB             SUB_BLK_COUNT_LUMA_4x4 * SUB_BLK_COUNT_LUMA_4x4
76 
77 /*Number of chroma coffs in an MB*/
78 #define SUB_BLK_CHROMA_4X4_CNT_MB           SUB_BLK_COUNT_CHROMA_4x4_420 * SUB_BLK_COUNT_CHROMA_4x4_420
79 #define SUB_BLK_CHROMA_4X4_CNT_MB_BIPLANE   SUB_BLK_CHROMA_4X4_CNT_MB*NUM_CHROMA_PLANES
80 
81 /*Size of trans buff = 4x4 for DC block +  4x4 * coffs for 4x4 ac blocks*/
82 #define SIZE_TRANS_BUFF                     (SUB_BLK_WIDTH_4x4*SUB_BLK_WIDTH_4x4*+ \
83                                             SUB_BLK_WIDTH_4x4*SUB_BLK_WIDTH_4x4*   \
84                                             SUB_BLK_COUNT_LUMA_4x4*SUB_BLK_COUNT_LUMA_4x4)
85 
86 /*memory size = memory size of 4x4 block of resi coff + 4x4 for DC coff block                          */
87 #define SIZE_TMP_BUFF_ITRANS                ((SUB_BLK_WIDTH_4x4*SUB_BLK_WIDTH_4x4) +\
88                                              (SUB_BLK_WIDTH_4x4*SUB_BLK_WIDTH_4x4))
89 
90 #endif /* _IH264_SIZE_DEFS_H_ */
91