• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2  * \copy
3  *     Copyright (c)  2013, Cisco Systems
4  *     All rights reserved.
5  *
6  *     Redistribution and use in source and binary forms, with or without
7  *     modification, are permitted provided that the following conditions
8  *     are met:
9  *
10  *        * Redistributions of source code must retain the above copyright
11  *          notice, this list of conditions and the following disclaimer.
12  *
13  *        * Redistributions in binary form must reproduce the above copyright
14  *          notice, this list of conditions and the following disclaimer in
15  *          the documentation and/or other materials provided with the
16  *          distribution.
17  *
18  *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24  *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28  *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  *     POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 //wels_const.h
34 #ifndef WELS_CONST_H__
35 #define WELS_CONST_H__
36 
37 #include "as264_common.h" //  to communicate with specific macros there, 3/18/2010
38 #include "codec_app_def.h"
39 #include "wels_const_common.h"
40 
41 /* To control number of spatial, quality and temporal layers constraint by application layer? */
42 #define NUM_SPATIAL_LAYERS_CONSTRAINT
43 #define NUM_QUALITY_LAYERS_CONSTRAINT
44 
45 
46 #define STATISTICS_LOG_INTERVAL_MS (5000) // output statistics log every 5s
47 
48 #define INTRA_4x4_MODE_NUM              8
49 #define MB_LUMA_CHROMA_BLOCK4x4_NUM     24
50 
51 #define MAX_PPS_COUNT_LIMITED           57// limit the max ID of PPS because of known limitation of receiver endpoints
52 #define MAX_PPS_COUNT                   (MAX_PPS_COUNT_LIMITED)//in Standard is 256     // Count number of PPS
53 
54 #define PARA_SET_TYPE                   3 // SPS+PPS
55 #define PARA_SET_TYPE_AVCSPS            0
56 #define PARA_SET_TYPE_SUBSETSPS         1
57 #define PARA_SET_TYPE_PPS               2
58 
59 #define MAX_VERTICAL_MV_RANGE           1024  //TODO, for allocate enough memory for transpose
60 #define MAX_FRAME_RATE                  60      // maximal frame rate to support
61 #define MIN_FRAME_RATE                  1       // minimal frame rate need support
62 
63 #define MAX_BIT_RATE                    INT_MAX // maximal bit rate to support
64 //TODO {Sijia}: 30fps*MaxCPB in level5.1 = 30*240000*1000bits = 7 200 000 000, larger than INT_MAX which is 2147483647, but this is also very big and abnormal number, should figure out a reasonable number after discussion
65 #define MIN_BIT_RATE                    1       // minimal bit rate need support
66 
67 #define SVC_QUALITY_BASE_QP             26
68 #define MAX_SLICEGROUP_IDS              8       // Count number of SSlice Groups
69 #define MAX_THREADS_NUM                 4       // assume to support up to 4 logical cores(threads)
70 
71 #define INTPEL_NEEDED_MARGIN            (3)  // for safe sub-pel MC
72 
73 #define I420_PLANES                     3
74 
75 #define COMPRESS_RATIO_THR (1.0f)       //set to size of the original data, which will be large enough considering MinCR
76 
77 #if !defined(SSEI_BUFFER_SIZE)
78 #define SSEI_BUFFER_SIZE        128
79 #endif//SSEI_BUFFER_SIZE
80 
81 #if !defined(SPS_BUFFER_SIZE)
82 #define SPS_BUFFER_SIZE         32
83 #endif//SPS_BUFFER_SIZE
84 
85 #if !defined(PPS_BUFFER_SIZE)
86 #define PPS_BUFFER_SIZE         16
87 #endif//PPS_BUFFER_SIZE
88 
89 #if !defined(MAX_MACROBLOCK_SIZE_IN_BYTE)
90 #define MAX_MACROBLOCK_SIZE_IN_BYTE     400 //3200/8, 3200 is from Annex A.3.1.(n)
91 #endif
92 
93 #define MAX_MACROBLOCK_SIZE_IN_BYTE_x2 (MAX_MACROBLOCK_SIZE_IN_BYTE<<1)
94 
95 #if defined(NUM_SPATIAL_LAYERS_CONSTRAINT)
96 #define MAX_DEPENDENCY_LAYER            MAX_SPATIAL_LAYER_NUM   // Maximal dependency layer
97 #else
98 #define MAX_DEPENDENCY_LAYER            8       // Maximal dependency layer
99 #endif//NUM_SPATIAL_LAYERS_CONSTRAINT
100 
101 //The max temporal level support is equal or less than MAX_TEMPORAL_LAYER_NUM defined @ codec_app_def.h
102 #define MAX_TEMPORAL_LEVEL              MAX_TEMPORAL_LAYER_NUM  // Maximal temporal level
103 
104 #if defined(NUM_QUALITY_LAYERS_CONSTRAINT)
105 #define MAX_QUALITY_LEVEL               MAX_QUALITY_LAYER_NUM           // Maximal quality level
106 #else
107 #define MAX_QUALITY_LEVEL               16      // Maximal quality level
108 #endif//NUM_QUALITY_LAYERS_CONSTRAINT
109 
110 #if defined(MAX_GOP_SIZE)
111 #undef MAX_GOP_SIZE
112 #endif//MAX_GOP_SIZE
113 #define MAX_GOP_SIZE    (1<<(MAX_TEMPORAL_LEVEL-1))
114 
115 #define MAX_SHORT_REF_COUNT             (MAX_GOP_SIZE>>1) // 16 in standard, maximal count number of short reference pictures
116 #define LONG_TERM_REF_NUM               2
117 #define LONG_TERM_REF_NUM_SCREEN        4
118 #define MAX_REF_PIC_COUNT               16 // 32 in standard, maximal Short + Long reference pictures
119 #define MIN_REF_PIC_COUNT               1               // minimal count number of reference pictures, 1 short + 2 key reference based?
120 #define MAX_MULTI_REF_PIC_COUNT         1       //maximum multi-reference number
121 //#define TOTAL_REF_MINUS_HALF_GOP      1       // last t0 in last gop
122 #define MAX_MMCO_COUNT                  66
123 
124 // adjusted numbers reference picture functionality related definition
125 #define MAX_REFERENCE_MMCO_COUNT_NUM            4       // adjusted MAX_MMCO_COUNT(66 in standard) definition per encoder design
126 #define MAX_REFERENCE_REORDER_COUNT_NUM         2       // adjusted MAX_REF_PIC_COUNT(32 in standard) for reference reordering definition per encoder design
127 #define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA          (MAX_SHORT_REF_COUNT+LONG_TERM_REF_NUM) // <= MAX_REF_PIC_COUNT, memory saved if <
128 #define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN          (MAX_SHORT_REF_COUNT+LONG_TERM_REF_NUM_SCREEN)  // <= MAX_REF_PIC_COUNT, memory saved if <
129 
130 #define BASE_DEPENDENCY_ID              0
131 #define MAX_DQ_LAYER_NUM                (MAX_DEPENDENCY_LAYER/**MAX_QUALITY_LEVEL*/)
132 
133 #define INVALID_ID                      (-1)
134 
135 #define NAL_HEADER_ADD_0X30BYTES        20
136 
137 #define SLICE_NUM_EXPAND_COEF           2
138 
139 enum {
140 BLOCK_16x16    = 0,
141 BLOCK_16x8     = 1,
142 BLOCK_8x16     = 2,
143 BLOCK_8x8      = 3,
144 BLOCK_4x4      = 4,
145 BLOCK_8x4      = 5,
146 BLOCK_4x8      = 6,
147 BLOCK_SIZE_ALL = 7
148 };
149 
150 typedef enum {
151 RECIEVE_UNKOWN = 0,
152 RECIEVE_SUCCESS = 1,
153 RECIEVE_FAILED = 2
154 } LTR_MARKING_RECEIVE_STATE;
155 
156 enum {
157   CUR_AU_IDX    = 0,                    // index symbol for current access unit
158   SUC_AU_IDX    = 1                     // index symbol for successive access unit
159 };
160 
161 enum {
162   ENC_RETURN_SUCCESS = 0,
163   ENC_RETURN_MEMALLOCERR = 0x01, //will free memory and uninit
164   ENC_RETURN_UNSUPPORTED_PARA = 0x02, //unsupported setting
165   ENC_RETURN_UNEXPECTED = 0x04, //unexpected value
166   ENC_RETURN_CORRECTED = 0x08, //unexpected value but corrected by encoder
167   ENC_RETURN_INVALIDINPUT = 0x10, //invalid input
168   ENC_RETURN_MEMOVERFLOWFOUND = 0x20,
169   ENC_RETURN_VLCOVERFLOWFOUND = 0x40,
170   ENC_RETURN_KNOWN_ISSUE = 0x80
171 };
172 //TODO: need to complete the return checking in encoder and fill in more types if needed
173 
174 #endif//WELS_CONST_H__
175