• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2018 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 *  ihevce_defs.h
25 *
26 * @brief
27 *  Definitions used in the codec
28 *
29 * @author
30 *  Ittiam
31 *
32 * @remarks
33 *  None
34 *
35 *******************************************************************************
36 */
37 #ifndef _IHEVCE_DEFS_H_
38 #define _IHEVCE_DEFS_H_
39 
40 /*****************************************************************************/
41 /* Constant Macros                                                           */
42 /*****************************************************************************/
43 
44 #define SINGLE_THREAD_INTERFACE 0
45 
46 #define DEFAULT_VPS_ID 0
47 
48 #define DEFAULT_SPS_ID 0
49 
50 #define DEFAULT_PPS_ID 0
51 
52 #define DEFAULT_CHROMA_FORMAT_IDC 1
53 
54 #define AMP_ENABLED 1
55 
56 #define AMP_DISABLED 0
57 
58 #define LISTS_MODIFICATION_ABSENT 0
59 
60 #define LISTS_MODIFICATION_PRESENT 1
61 
62 #define LONG_TERM_REF_PICS_PRESENT 1
63 
64 #define LONG_TERM_REF_PICS_ABSENT 0
65 
66 #define PCM_ENABLED 1
67 
68 #define PCM_DISABLED 0
69 
70 #define PCM_LOOP_FILTER_DISABLED 1
71 
72 #define PCM_LOOP_FILTER_ENABLED 0
73 
74 #define REF_PIC_LISTS_RESTRICTED 1
75 
76 #define REF_PIC_LISTS_UNRESTRICTED 0
77 
78 #define SCALING_LIST_DISABLED 0
79 
80 #define SCALING_LIST_ENABLED 1
81 
82 #define DEFAULT_SPS_MAX_SUB_LAYERS 1
83 
84 #define VPS_SUB_LAYER_ORDERING_INFO_PRESENT 1
85 
86 #define VPS_SUB_LAYER_ORDERING_INFO_ABSENT 0
87 
88 #define SPS_SUB_LAYER_ORDERING_INFO_PRESENT 1
89 
90 #define SPS_SUB_LAYER_ORDERING_INFO_ABSENT 0
91 
92 #define SCALING_LIST_DATA_PRESENT 1
93 
94 #define SCALING_LIST_DATA_ABSENT 0
95 
96 #define SPS_TEMPORAL_ID_NESTING_DONE 1
97 
98 #define NO_SPS_TEMPORAL_ID_NESTING_DONE 0
99 
100 #define STRONG_INTRA_SMOOTHING_FLAG_DISABLE 0
101 
102 #define STRONG_INTRA_SMOOTHING_FLAG_ENABLE 1
103 
104 #define DEFAULT_LOG2_MAX_POC_LSB 10
105 
106 #define DEFAULT_PIC_CROP_TOP_OFFSET 0
107 
108 #define DEFAULT_PIC_CROP_LEFT_OFFSET 0
109 
110 #define DEFAULT_PIC_CROP_RIGHT_OFFSET 0
111 
112 #define DEFAULT_PIC_CROP_BOTTOM_OFFSET 0
113 
114 #define DEFAULT_MAX_DEC_PIC_BUFFERING 8
115 
116 #define DEFAULT_MAX_NUM_REORDER_PICS 8
117 
118 #define DEFAULT_MAX_LATENCY_INCREASE 8
119 
120 #define HIGH_TIER 1
121 
122 #define MAIN_TIER 0
123 
124 #define DEFAULT_BETA_OFFSET 0
125 
126 #define CABAC_INIT_PRESENT 1
127 
128 #define CABAC_INIT_ABSENT 0
129 
130 #define CU_QP_DELTA_ENABLED 1
131 
132 #define CU_QP_DELTA_DISABLED 0
133 
134 #define MAX_MERGE_CANDIDATES 5
135 
136 #define CONSTR_IPRED_ENABLED 1
137 
138 #define CONSTR_IPRED_DISABLED 0
139 
140 #define DISABLE_DEBLOCKING_FLAG 1
141 
142 #define ENABLE_DEBLOCKING_FLAG 0
143 
144 #define DEBLOCKING_FILTER_CONTROL_PRESENT 1
145 
146 #define DEBLOCKING_FILTER_CONTROL_ABSENT 0
147 
148 #define DEBLOCKING_FILTER_OVERRIDE_ENABLED 1
149 
150 #define DEBLOCKING_FILTER_OVERRIDE_DISABLED 0
151 
152 #define DEPENDENT_SLICE_ENABLED 1
153 
154 #define DEPENDENT_SLICE_DISABLED 0
155 
156 #define DEFAULT_DIFF_CU_QP_DELTA_DEPTH 0
157 
158 #define ENTROPY_CODING_SYNC_ENABLED 1
159 
160 #define ENTROPY_CODING_SYNC_DISABLED 0
161 
162 #define ENTROPY_SLICE_ENABLED 1
163 
164 #define ENTROPY_SLICE_DISABLED 0
165 
166 #define DEFAULT_PARALLEL_MERGE_LEVEL 2
167 
168 #define DEFAULT_NUM_REF_IDX_L0_DEFAULT_ACTIVE 6
169 
170 #define DEFAULT_NUM_REF_IDX_L1_DEFAULT_ACTIVE 6
171 
172 #define NUM_TILES_COLS 0
173 
174 #define NUM_TILES_ROWS 0
175 
176 #define OUTPUT_FLAG_PRESENT 1
177 
178 #define OUTPUT_FLAG_ABSENT 0
179 
180 #define DEFAULT_PIC_CB_QP_OFFSET 0
181 
182 #define DEFAULT_PIC_CR_QP_OFFSET 0
183 
184 #define SLICE_LEVEL_CHROMA_QP_OFFSETS_PRESENT 1
185 
186 #define SLICE_LEVEL_CHROMA_QP_OFFSETS_ABSENT 0
187 
188 #define DEBLOCKING_FILTER_DISABLED 1
189 
190 #define DEBLOCKING_FILTER_ENABLED 0
191 
192 #define LF_ACROSS_SLICES_ENABLED 1
193 
194 #define LF_ACROSS_SLICES_DISABLED 0
195 
196 #define SAO_ENABLED 1
197 
198 #define SAO_DISABLED 0
199 
200 #define SCALING_LIST_DATA_PRESENT 1
201 
202 #define SCALING_LIST_DATA_ABSENT 0
203 
204 #define SIGN_DATA_HIDDEN 1
205 
206 #define SIGN_DATA_UNHIDDEN 0
207 
208 #define SLICE_EXTENSION_PRESENT 1
209 
210 #define SLICE_EXTENSION_ABSENT 0
211 
212 #define SLICE_HEADER_EXTENSION_PRESENT 1
213 
214 #define SLICE_HEADER_EXTENSION_ABSENT 0
215 
216 #define DEFAULT_TC_OFFSET 0
217 
218 #define TRANSFORM_SKIP_ENABLED 1
219 
220 #define TRANSFORM_SKIP_DISABLED 0
221 
222 #define TRANSFORM_BYPASS_ENABLED 1
223 
224 #define TRANSFORM_BYPASS_DISABLED 0
225 
226 #define SPACING_IS_UNIFORM 1
227 
228 #define SPACING_IS_NONUNIFORM 0
229 
230 #define TILES_ENABLED 1
231 
232 #define TILES_DISABLED 0
233 
234 #define TOTAL_NUM_TIERS 2
235 
236 #define TOTAL_NUM_LEVELS 13
237 
238 #define SET_CTB_ALIGN(x, y) ((((x) & ((y)-1)) == 0) ? 0 : (y) - ((x) & ((y)-1)))
239 
240 /* Enables HM-8.1 compatible stream, setting to 0 will make it 8.2 compatible*/
241 #define HM_8DOT1_SYNTAX 0
242 
243 /* Enables cu level RD optimized encoding by computing cabac bits for the cu */
244 #define RDOPT_ENABLE 1
245 
246 /* Enables inclusion of chroma coding cost for RD opt decisions */
247 #define CHROMA_RDOPT_ENABLE 1
248 
249 /* Enables tu level zero cbf based RD optimized encoding */
250 #define RDOPT_ZERO_CBF_ENABLE 1
251 
252 /* Enables bit savings in tu tree of inter cus by merging not coded child nodes to parent node */
253 #define SHRINK_INTER_TUTREE 1
254 
255 /*  q format for lamba used in the encoder                                   */
256 #define LAMBDA_Q_SHIFT 8
257 
258 /* If 0, Allign PIC Wd/ht to Min CU size  */
259 /* If 1, Allign PIC Wd/ht to CTB size  */
260 #define PIC_ALIGN_CTB_SIZE 0
261 
262 /** Enables DCT integer transform / Hadamard Transform based SATD evaluation
263   * 1 : DCT integer Transform,  0 : Hadamard Transform
264   */
265 #define USE_EXACT_TFR 0
266 
267 /** Enable colocated PU population */
268 #define ENABLE_COL_PU_POPULATION 1
269 
270 #define MAX_MVX_SUPPORTED_IN_COARSE_LAYER 128
271 
272 #define MAX_MVY_SUPPORTED_IN_COARSE_LAYER 64
273 
274 //ME_Experiments
275 
276 #define USE_4x4_IN_L1 0
277 
278 #define DIAMOND_GRID 1
279 
280 #define SUBPEL_DEDUPLICATE_ENABLE 1
281 
282 /** Enables CU delta QP population within a frame : Random for now */
283 //#define RANDOM_CU_QP  0
284 
285 /**
286  * @brief  Mapping of Minimum HEVC qp to MPEG2 QP
287  */
288 #define MIN_RC_QP (1)
289 /**
290  * @brief  Mapping of Maximum HEVC qp to MPEG2 QP
291  */
292 #define MAX_RC_QP (228)
293 /**
294  * @brief  Total NUmber of MPEG2 QPs
295  */
296 #define MPEG2_QP_ELEM (MAX_RC_QP + 1)
297 /**
298  * @brief  Total NUmber of HEVC QPs
299  */
300 #define HEVC_QP_ELEM (MAX_HEVC_QP_10bit + 1)
301 
302 #define QP_LEVEL_MOD_ACT_FACTOR 10
303 
304 #define TWO_POW_QP_LEVEL_MOD_ACT_FACTOR (1 << (QP_LEVEL_MOD_ACT_FACTOR))
305 
306 #define DEFAULT_NON_PACKED_CONSTRAINT_FLAG 1
307 
308 #define DEFAULT_FRAME_ONLY_CONSTRAINT_FLAG 0
309 
310 #define ENABLE_CU_TREE_CULLING (1 && ENABLE_4CTB_EVALUATION)
311 
312 #define RATIONALISE_NUM_RDO_MODES_IN_PQ_AND_HQ 1
313 
314 #define MAX_NUMBER_OF_INTER_RDOPT_CANDS_IN_PQ_AND_HQ 2
315 
316 #define MAX_NUMBER_OF_INTER_RDOPT_CANDS_IN_MS 2
317 
318 #define MAX_NUMBER_OF_INTER_RDOPT_CANDS_IN_HS_AND_XS 1
319 
320 #define BUFFER_SIZE_MULTIPLIER_IF_HBD 3
321 
322 /* If  */
323 /* qp_bdoffset = 6 * (bit_depth - 8) */
324 /* and */
325 /* lambda = pow(2.0, (((i4_cur_frame_qp + qp_bdoffset - 12)) / 3)), */
326 /* Then 'Lambda Types' are - */
327 /* 0, when bit_depth_in_module = 8 => qp_bdoffset = 0 always */
328 /* 1, when bit_depth_in_module > 8, => qp_bdoffset = value derived above */
329 /* 2, when both of the lambdas referred to in the previous cases are required */
330 
331 #define PRE_ENC_LAMBDA_TYPE 0
332 
333 #define ENC_LAMBDA_TYPE 0
334 
335 #define IPE_LAMBDA_TYPE 0
336 
337 #define ME_LAMBDA_TYPE 0
338 
339 #define ENC_LOOP_LAMBDA_TYPE 2
340 
341 #define ENABLE_SSIM 0
342 
343 #define VUI_BIT_RATE_SCALE 6
344 
345 #define VUI_CPB_SIZE_SCALE 8
346 
347 #define CBP_VCL_FACTOR 1000
348 
349 #define ENABLE_REFINED_QP_MOD 1
350 
351 #if ENABLE_REFINED_QP_MOD
352 /* to find the uncovered region (or new region) which will be used for reference for the upcoming pictures
353     will be coded well to enhance coding efficiency*/
354 #define ENABLE_TEMPORAL_WEIGHING 0
355 
356 /* to enable modulation factor  based on spatial variance when we calculate activity factor using
357     the following equaltion
358     act_factor = (m * c + a )/(c + m * a)*/
359 // SATD_NOISE_FLOOR_THRESHOLD was earlier controlled using this
360 #define ENABLE_QP_MOD_BASED_ON_SPATIAL_VARIANCE 0
361 
362 /* To enable the trace for delta Qp bits */
363 #define QP_DELTA_BITS_TRACE
364 
365 /* to enable modulation based LAP2 average satd*/
366 #define MODULATION_OVER_LAP 1
367 
368 /* 0 - Lamda and Qp are decoupled,
369        1 - Lamda and Qp are coupled*/
370 #define LAMDA_BASED_ON_QUANT 0
371 
372 /*
373        0 - act_factor = (m * c + a )/(c + m * a)
374            m = modulation factor
375            c = cur satd
376            a = average satd
377        ----------------------------------------
378        1 - act_factor = (c/a) ^ (s/3)
379            s = strength
380            c = cur satd
381            a = average satd
382     */
383 #define LOGARITHMIC_MODULATION 1
384 
385 #define MEDIAN_ENABLE 1
386 #define MIN_ENABLE 0
387 
388 /* well compensatable regions are not considered for
389     QP modulation*/
390 #define DISABLE_COMPENSATION 1
391 
392 #define CST_NOISE_THRSHLD 0
393 
394 /*decrease intra cu qp by 1 in Inter Pictures*/
395 #define DECREASE_QP 0
396 
397 /*strength calculation based on deviation*/
398 #define STRENGTH_BASED_ON_DEVIATION 1
399 
400 /*enable allow cliping of qctivity factor such that
401     deviation of qp in modulation is controlled*/
402 #define ALLOW_ACT_FACTOR_CLIP_IN_QP_MOD 1
403 
404 /*instead of avg activity use sqrt(avg of satd square)*/
405 #define USE_SQRT_AVG_OF_SATD_SQR 1
406 
407 /*use sum of squared transform coeff*/
408 #define USE_SQR_SATD_COEFF 0
409 
410 /*instead of L1 IPE SATD, use L1 CUR SATD*/
411 #define USE_CUR_SATD 0  // else it will use satd of cur - pred
412 
413 /*use L0 CUR SATD */
414 #define USE_CUR_L0_SATD 0
415 
416 /* strength based on only curr frame deviation else it is based on average over lap2 */
417 #define STRENGTH_BASED_ON_CURR_FRM 0
418 
419 #define POW_OPT 1
420 
421 #else /*INITIAL QP MOD*/
422 /*Same as 11_0 Mod version */
423 // SATD_NOISE_FLOOR_THRESHOLD was earlier controlled using this
424 #define ENABLE_QP_MOD_BASED_ON_SPATIAL_VARIANCE 0
425 #define ENABLE_TEMPORAL_WEIGHING 0
426 #define MODULATION_OVER_LAP 0
427 #define LAMDA_BASED_ON_QUANT 1
428 #define LOGARITHMIC_MODULATION 0
429 #define MIN_ENABLE 1
430 #define DISABLE_COMPENSATION 1
431 #define CST_NOISE_THRSHLD 1
432 #define DECREASE_QP 0
433 #endif
434 
435 #define MASK_4AC 0xFFFFFFFEFEFEFCE0
436 #define MASK_3AC 0xFFFFFFFFFEFEFCF0
437 #define MASK_2AC 0xFFFFFFFFFFFEFCF8
438 #define MASK_DC 0xFFFFFFFFFFFFFFFE
439 #define I_PIC_LAMDA_MODIFIER 0.5
440 #define CONST_LAMDA_MODIFIER 1
441 #define NO_EXTRA_MULTIPLIER 1
442 #define NEW_LAMDA_MODIFIER (!CONST_LAMDA_MODIFIER)
443 #define LAMDA_MODIFIER(QP, Tid)                                                                    \
444     (0.85 * pow(2.0, (Tid * (CLIP3(((QP + 5.0) / 25.0), 1.0, 2.0) - 1.0)) / 3.0))
445 #define CONST_LAMDA_MOD_VAL (0.85)
446 #define MEAN_BASED_QP_MOD 0
447 
448 #if MEDIAN_ENABLE
449 #define MEDIAN_CU_TU 1
450 #define MEDIAN_CU_TU_BY_2 3
451 #define MEDIAN_CU_TU_BY_4 10
452 #endif
453 
454 #if MIN_ENABLE
455 #define MEDIAN_CU_TU 0
456 #define MEDIAN_CU_TU_BY_2 0
457 #define MEDIAN_CU_TU_BY_4 0
458 #endif
459 
460 #define COMP_RATIO_NORM 5
461 #define COMP_RATIO_MIN 0
462 #define COMP_RATIO_MAX 3
463 #define NOISE_THRE_MAP_TO_8 3
464 
465 #define REF_MOD_VARIANCE (0.6696)
466 
467 #define REF_MOD_DEVIATION (473.0)  //(0.6696) //
468 #define NO_MOD_DEVIATION (220.0)
469 #define BELOW_REF_DEVIATION (0.0)
470 #define ABOVE_REF_DEVIATION (220.0)
471 
472 #define MIN_QP_MOD_OFFSET -10
473 #define MAX_QP_MOD_OFFSET 3
474 #define TOT_QP_MOD_OFFSET (MAX_QP_MOD_OFFSET - MIN_QP_MOD_OFFSET + 1)
475 
476 #define ENABLE_UNIFORM_CU_SIZE_16x16 0
477 
478 #define ENABLE_UNIFORM_CU_SIZE_8x8 0
479 
480 #define MAX_QP_BD_OFFSET 24
481 
482 // chroma mode index for derived from luma intra mode
483 #define DM_CHROMA_IDX 36
484 
485 #define DISABLE_RDOQ 0
486 
487 #define DISABLE_SKIP_AND_MERGE_EVAL 0
488 
489 #define ENABLE_PICKING_4_BEST_IN_B_PIC_IN_ME 0
490 
491 #define ENABLE_TU_TREE_DETERMINATION_IN_RDOPT 0
492 
493 #define MAX_NUM_MIXED_MODE_INTER_RDO_CANDS (MAX_NUMBER_OF_INTER_RDOPT_CANDS_IN_PQ_AND_HQ * 2)
494 
495 #define MAX_NUM_CU_MERGE_SKIP_CAND (MAX_NUMBER_OF_INTER_RDOPT_CANDS_IN_PQ_AND_HQ + 1)
496 
497 #define NUM_MODE_COMBINATIONS_IN_INTER_CU_WITH_2_PUS 4
498 
499 /* +1 for skip candidate */
500 #define MAX_NUM_INTER_RDO_CANDS                                                                    \
501     (NUM_MODE_COMBINATIONS_IN_INTER_CU_WITH_2_PUS * MAX_NUMBER_OF_INTER_RDOPT_CANDS_IN_PQ_AND_HQ + \
502      1)
503 
504 #define UNI_SATD_SCALE 1
505 
506 #define ENABLE_MIXED_INTER_MODE_EVAL 1
507 
508 #define DISABLE_SAO 0
509 
510 #define DISABLE_LUMA_SAO (0 || (DISABLE_SAO))
511 
512 #define DISABLE_CHROMA_SAO (0 || (DISABLE_SAO))
513 
514 #define MAX_NUM_INTER_CANDS_PQ 4 /*MAX_NUM_INTER_RDO_CANDS*/
515 
516 #define MAX_NUM_INTER_CANDS_HQ 4 /*MAX_NUM_INTER_RDO_CANDS*/
517 
518 #define MAX_NUM_INTER_CANDS_MS 3
519 
520 #define MAX_NUM_INTER_CANDS_HS 2
521 
522 #define MAX_NUM_INTER_CANDS_ES 2
523 
524 #define RESTRICT_NUM_INTER_CANDS_PER_PART_TYPE 0
525 
526 #define MAX_NUM_INTER_CANDS_PER_PART_TYPE 3
527 
528 #define PICK_ONLY_BEST_CAND_PER_PART_TYPE 0
529 
530 #define REUSE_ME_COMPUTED_ERROR_FOR_INTER_CAND_SIFTING 0
531 
532 #define DISABLE_SBH 0
533 
534 #define DISABLE_TMVP 0
535 
536 #define DISABLE_QUANT_ROUNDING 0
537 
538 #define ENABLE_SEPARATE_LUMA_CHROMA_INTRA_MODE 1
539 
540 #define FORCE_INTRA_TU_DEPTH_TO_0 0
541 
542 #define WEIGH_CHROMA_COST 1
543 
544 #define ENABLE_ZERO_CBF_IN_INTRA 0
545 
546 #define DISABLE_ZERO_ZBF_IN_INTER 0
547 
548 #define ENABLE_INTER_ZCU_COST 1
549 
550 #define ADAPT_COLOCATED_FROM_L0_FLAG 1
551 
552 #define CHROMA_COST_WEIGHING_FACTOR_Q_SHIFT 10
553 
554 #define ENABLE_SSD_CALC_RC 0
555 
556 #define SRC_PADDING_FOR_TRAQO 1
557 
558 #define ENABLE_CU_SPLIT_FLAG_RATE_ESTIMATION 1
559 
560 #define ZCBF_SKIP_DISTORTION_THRESHOLD (1.2)
561 
562 #define ENABLE_CHROMA_RDOPT_EVAL_IN_PQ 1
563 
564 #define ENABLE_CHROMA_RDOPT_EVAL_IN_HQ 1
565 
566 #define ENABLE_CHROMA_RDOPT_EVAL_IN_MS 1
567 
568 #define ENABLE_CHROMA_RDOPT_EVAL_IN_HS 0
569 
570 #define ENABLE_CHROMA_RDOPT_EVAL_IN_XS 0
571 
572 #define ENABLE_CHROMA_RDOPT_EVAL_IN_XS6 0
573 
574 #define ENABLE_ADDITIONAL_CHROMA_MODES_EVAL_IN_PQ                                                  \
575     (1 && (ENABLE_CHROMA_RDOPT_EVAL_IN_PQ) && (ENABLE_SEPARATE_LUMA_CHROMA_INTRA_MODE))
576 
577 #define ENABLE_ADDITIONAL_CHROMA_MODES_EVAL_IN_HQ                                                  \
578     (1 && (ENABLE_CHROMA_RDOPT_EVAL_IN_HQ) && (ENABLE_SEPARATE_LUMA_CHROMA_INTRA_MODE))
579 
580 #define ENABLE_ADDITIONAL_CHROMA_MODES_EVAL_IN_MS                                                  \
581     (0 && (ENABLE_CHROMA_RDOPT_EVAL_IN_MS) && (ENABLE_SEPARATE_LUMA_CHROMA_INTRA_MODE))
582 
583 #define ENABLE_ADDITIONAL_CHROMA_MODES_EVAL_IN_HS                                                  \
584     (0 && (ENABLE_CHROMA_RDOPT_EVAL_IN_HS) && (ENABLE_SEPARATE_LUMA_CHROMA_INTRA_MODE))
585 
586 #define ENABLE_ADDITIONAL_CHROMA_MODES_EVAL_IN_XS                                                  \
587     (0 && (ENABLE_CHROMA_RDOPT_EVAL_IN_XS) && (ENABLE_SEPARATE_LUMA_CHROMA_INTRA_MODE))
588 
589 #define ENABLE_ADDITIONAL_CHROMA_MODES_EVAL_IN_XS6                                                 \
590     (0 && (ENABLE_CHROMA_RDOPT_EVAL_IN_XS6) && (ENABLE_SEPARATE_LUMA_CHROMA_INTRA_MODE))
591 
592 #define RC_BUFFER_INFO 0
593 
594 #define DISABLE_SMP_IN_XS25 1
595 
596 #define DISABLE_64X64_BLOCK_MERGE_IN_ME_IN_XS25 1
597 
598 #define MAX_NUM_TU_RECUR_CANDS_IN_XS25 1
599 
600 #define MAX_NUM_CANDS_FOR_FPEL_REFINE_IN_XS25 1
601 
602 #define MAX_NUM_CONSTITUENT_MVS_TO_ENABLE_32MERGE_IN_XS25 4
603 
604 #define NUM_INIT_SEARCH_CANDS_IN_L1_AND_L2_ME_IN_XS25 2
605 
606 #define DISABLE_TOP_SYNC 0
607 
608 #define ENABLE_MULTI_THREAD_FILE_WRITES 0
609 
610 #define DISABLE_EARLY_ZCBF 0
611 
612 #define EARLY_CBF_ON 1
613 
614 #define DUMP_CBF_HIST_DATA 0
615 
616 #define ENABLE_INTRA_MODE_FILTERING_IN_XS25 1
617 
618 #define MAX_NUM_INTRA_MODES_PER_TU_DISTRIBUTION_IN_XS25 2
619 
620 #define MAX_NUM_REFS_IN_PPICS_IN_XS25 1
621 
622 #define USE_CONSTANT_LAMBDA_MODIFIER 0
623 
624 /* Actual Lambda in ME -> (100 - ME_LAMBDA_DISCOUNT) * lambda / 100 */
625 #define ME_LAMBDA_DISCOUNT 0
626 
627 #define FORCE_AT_LEAST_1_UNICAND_IN_BPICS 0
628 
629 #define MULTI_REF_ENABLE 1
630 
631 #define PROHIBIT_INTRA_QUANT_ROUNDING_FACTOR_TO_DROP_BELOW_1BY3 0
632 
633 #define ENABLE_INTRA_GATING_FOR_HQ 0
634 
635 #define ADD_NOISE_TERM_TO_COST 1
636 
637 #define ALPHA_Q_FORMAT 4
638 #define ALPHA_FOR_NOISE_TERM_IN_ME_P (1 << ((ALPHA_Q_FORMAT)-2))  //0.25
639 #define ALPHA_FOR_NOISE_TERM_IN_ME_BREF (1 << ((ALPHA_Q_FORMAT)-2))  //0.25
640 #define ALPHA_FOR_NOISE_TERM_IN_RDOPT_P (1 << ((ALPHA_Q_FORMAT)-2))
641 
642 #define ALPHA_FOR_NOISE_TERM (1 << ((ALPHA_Q_FORMAT)-2))
643 
644 #define ALPHA_FOR_NOISE_TERM_IN_ME (ALPHA_FOR_NOISE_TERM)
645 
646 #define ALPHA_FOR_NOISE_TERM_IN_RDOPT (ALPHA_FOR_NOISE_TERM)
647 
648 #define ALPHA_DISCOUNT_IN_REF_PICS_IN_RDOPT 50
649 
650 #define ALPHA_FOR_ZERO_CODING_DECISIONS (ALPHA_FOR_NOISE_TERM_IN_RDOPT)
651 
652 #define STIM_Q_FORMAT 8
653 
654 #define USE_NOISE_TERM_IN_L0_ME (1 && (ADD_NOISE_TERM_TO_COST))
655 
656 #define USE_NOISE_TERM_IN_ENC_LOOP (1 && (ADD_NOISE_TERM_TO_COST))
657 
658 #define COMPUTE_NOISE_TERM_AT_THE_TU_LEVEL (1 && (USE_NOISE_TERM_IN_ENC_LOOP))
659 
660 #define DISABLE_SUBPEL_REFINEMENT_WHEN_SRC_IS_NOISY (0 && (USE_NOISE_TERM_IN_L0_ME))
661 
662 #define USE_NOISE_TERM_DURING_BICAND_SEARCH (1 && (USE_NOISE_TERM_IN_L0_ME))
663 
664 #define DISABLE_BLK_MERGE_WHEN_NOISY (0 && (USE_NOISE_TERM_IN_L0_ME))
665 
666 /* Macros for Noise detection implmentation */
667 #define NOISE_DETECT (ADD_NOISE_TERM_TO_COST)
668 
669 #define PSY_RD_DEBUG_CTBX 2048
670 #define PSY_RD_DEBUG_CTBY 1600
671 #define DEBUG_POC_NO 0
672 
673 #define DISABLE_LARGE_INTRA_PQ 1
674 
675 #define EVERYWHERE_NOISY 0
676 
677 #define DEBUG_PRINT_NOISE_SPATIAL 0
678 
679 #define DEBUG_PRINT_NOISE_TEMPORAL 0
680 
681 #define TEMPORAL_NOISE_DETECT (1 && (USE_NOISE_TERM_IN_L0_ME) && !(EVERYWHERE_NOISY))
682 
683 #define MIN_NOISY_BLOCKS_CNT_16x16 7
684 
685 #define ALTERNATE_METRIC 0
686 
687 #define PSY_STRENGTH_CHROMA 2  // 0.5 in Q2
688 
689 #define Q_PSY_STRENGTH_CHROMA 2
690 
691 #define PSY_STRENGTH 4  // 0.5 in Q2
692 
693 #define Q_PSY_STRENGTH 2
694 
695 /* between 0 and 100 */
696 #define MIN_ENERGY_FOR_NOISE_PERCENT_16x16 20
697 
698 /* normalised value between 0 and 1 */
699 #define MIN_VARIANCE_FOR_NOISE_16x16 0.6
700 
701 /* HAD size is restricted to square blocks only. so we specify only one dimension */
702 #define HAD_BLOCK_SIZE_16x16 16
703 
704 #define MIN_NUM_COEFFS_ABOVE_AVG_16x16 41
705 
706 #define MIN_COEFF_AVG_ENERGY_16x16 0
707 
708 #define MIN_NOISY_BLOCKS_CNT_8x8 30
709 
710 /* between 0 and 100 */
711 #define MIN_ENERGY_FOR_NOISE_PERCENT_8x8 20
712 
713 /* normalised value between 0 and 1 */
714 #define MIN_VARIANCE_FOR_NOISE_8x8 0.6
715 
716 /* HAD size is restricted to square blocks only. so we specify only one dimension */
717 #define HAD_BLOCK_SIZE_8x8 8
718 
719 #define MIN_NUM_COEFFS_ABOVE_AVG_8x8 17
720 
721 #define MIN_COEFF_AVG_ENERGY_8x8 0
722 
723 #define SATD_NOISE_FLOOR_THRESHOLD 16
724 
725 #define ENABLE_DEBUG_PRINTS_IN_ME 0
726 
727 #define RC_DEBUG_LEVEL_1 0
728 
729 #define RC_2PASS_GOP_DEBUG 0
730 
731 #define DUMP_NOISE_MAP 0
732 
733 #define DISABLE_SKIP 0
734 
735 #define DISABLE_NOISE_DETECTION_IN_P_PICS (0 && (NOISE_DETECT))
736 
737 #define MAX_LAYER_ID_OF_B_PICS_WITHOUT_NOISE_DETECTION                                             \
738     ((1 == (DISABLE_NOISE_DETECTION_IN_P_PICS)) ? 0 : 0)
739 
740 #define DISABLE_INTRA_WHEN_NOISY (0 && (NOISE_DETECT))
741 
742 #define DISABLE_BIPRED_MODES_WHEN_NOISY (0 && (ADD_NOISE_TERM_TO_COST))
743 
744 #define TEMPORAL_VARIANCE_FACTOR 3  // in Q2
745 
746 #define Q_TEMPORAL_VARIANCE_FACTOR 2
747 
748 /* Actual Lambda -> (100 - ME_LAMBDA_DISCOUNT_WHEN_NOISY) * lambda / 100 */
749 /*(((100 * (ALPHA_FOR_NOISE_TERM_IN_ME) + (1 << ((ALPHA_Q_FORMAT) - 1)))) >> (ALPHA_Q_FORMAT))*/
750 #define ME_LAMBDA_DISCOUNT_WHEN_NOISY 50
751 
752 /*(((100 * (ALPHA_FOR_NOISE_TERM_IN_RDOPT) + (1 << ((ALPHA_Q_FORMAT) - 1)))) >> (ALPHA_Q_FORMAT))*/
753 #define RDOPT_LAMBDA_DISCOUNT_WHEN_NOISY 25
754 
755 #define DISABLE_SKIP_AND_MERGE_WHEN_NOISY (0 && (USE_NOISE_TERM_IN_ENC_LOOP))
756 
757 #define NO_QP_OFFSET 0
758 
759 #define CONVERT_SSDS_TO_SPATIAL_DOMAIN (1 || (USE_NOISE_TERM_IN_ENC_LOOP))
760 
761 #define MAX_QP_WHERE_SPATIAL_SSD_ENABLED 18
762 
763 #define USE_RECON_TO_EVALUATE_STIM_IN_RDOPT (1 && (USE_NOISE_TERM_IN_ENC_LOOP))
764 
765 #define DISABLE_SAO_WHEN_NOISY (1 && (USE_NOISE_TERM_IN_ENC_LOOP))
766 
767 #define MAX_TU_SIZE_WHEN_NOISY 64
768 
769 #define RANDOMIZE_MERGE_IDX_WHEN_NOISY (0 && (USE_NOISE_TERM_IN_ENC_LOOP))
770 
771 #define MAX_CU_SIZE_WHERE_MERGE_AND_SKIPS_ENABLED_AND_WHEN_NOISY 64
772 
773 #define NUM_ELEMENTS_IN_RANDOMIZED_MERGE_IDX_LIST 113
774 
775 #define NUM_MERGE_INDICES_TO_PICK_WHEN_LIST_RANDOMIZED_MAXIDX4                                     \
776     ((DISABLE_SKIP_AND_MERGE_WHEN_NOISY) ? 0 : 2)
777 
778 #define NUM_MERGE_INDICES_TO_PICK_WHEN_LIST_RANDOMIZED_MAXIDX3                                     \
779     ((DISABLE_SKIP_AND_MERGE_WHEN_NOISY) ? 0 : 2)
780 
781 #define NUM_MERGE_INDICES_TO_PICK_WHEN_LIST_RANDOMIZED_MAXIDX2                                     \
782     ((DISABLE_SKIP_AND_MERGE_WHEN_NOISY) ? 0 : 1)
783 
784 #define NUM_MERGE_INDICES_TO_PICK_WHEN_LIST_RANDOMIZED_MAXIDX1                                     \
785     ((DISABLE_SKIP_AND_MERGE_WHEN_NOISY) ? 0 : 1)
786 
787 #define USE_NOISE_TERM_IN_ZERO_CODING_DECISION_ALGORITHMS                                          \
788     (1 && (COMPUTE_NOISE_TERM_AT_THE_TU_LEVEL))
789 
790 #define BITPOS_IN_VQ_TOGGLE_FOR_CONTROL_TOGGLER 0
791 
792 #define BITPOS_IN_VQ_TOGGLE_FOR_ENABLING_NOISE_PRESERVATION 29
793 
794 #define BITPOS_IN_VQ_TOGGLE_FOR_ENABLING_PSYRDOPT_1 5
795 #define BITPOS_IN_VQ_TOGGLE_FOR_ENABLING_PSYRDOPT_2 6
796 #define BITPOS_IN_VQ_TOGGLE_FOR_ENABLING_PSYRDOPT_3 7
797 
798 #define MODULATE_LAMDA_WHEN_SPATIAL_MOD_ON 1
799 
800 #define MODULATE_LAMDA_WHEN_TRAQO_MOD_ON 1
801 
802 #define ENABLE_RUNTIME_ARCH_SWITCH 1
803 
804 #define DISABLE_8X8CUS_IN_NREFBPICS_IN_P6 1
805 
806 #define DISABLE_8X8CUS_IN_REFBPICS_IN_P6 (0 && (DISABLE_8X8CUS_IN_NREFBPICS_IN_P6))
807 
808 #define DISABLE_8X8CUS_IN_PPICS_IN_P6 (0 && (DISABLE_8X8CUS_IN_REFBPICS_IN_P6))
809 
810 #define L0ME_IN_OPENLOOP_MODE 0
811 
812 #define DISABLE_INTRAS_IN_BPIC 0
813 
814 #define MAX_RE_ENC 1
815 
816 #define ENABLE_RDO_BASED_TU_RECURSION 1
817 
818 #define ENABLE_TOP_DOWN_TU_RECURSION 1
819 
820 #define INCLUDE_CHROMA_DURING_TU_RECURSION (0 && (ENABLE_RDO_BASED_TU_RECURSION))
821 
822 #define PROCESS_GT_1CTB_VIA_CU_RECUR_IN_FAST_PRESETS (0)
823 
824 #define PROCESS_INTRA_AND_INTER_CU_TREES_SEPARATELY                                                \
825     (0 && (PROCESS_GT_1CTB_VIA_CU_RECUR_IN_FAST_PRESETS))
826 
827 #define RESTRICT_NUM_PARTITION_LEVEL_L0ME_RESULTS_TO_1 1
828 
829 #define RESTRICT_NUM_PARTITION_LEVEL_L1ME_RESULTS_TO_1 1
830 
831 #define RESTRICT_NUM_PARTITION_LEVEL_L2ME_RESULTS_TO_1 1
832 
833 #define RESTRICT_NUM_SEARCH_CANDS_PER_SEARCH_CAND_LOC 1
834 
835 #define RESTRICT_NUM_2NX2N_TU_RECUR_CANDS 1
836 
837 /*****************************************************************************/
838 /* Function Macros                                                           */
839 /*****************************************************************************/
840 
841 #define CREATE_SUBBLOCK2CSBFID_MAP(map, numMapElements, transSize, csbfBufStride)                  \
842     {                                                                                              \
843         WORD32 i, j;                                                                               \
844                                                                                                    \
845         WORD32 i4NumSubBlocksPerRow = transSize / 4;                                               \
846         WORD32 i4NumSubBlocksPerColumn = i4NumSubBlocksPerRow;                                     \
847                                                                                                    \
848         ASSERT(numMapElements >= i4NumSubBlocksPerRow * i4NumSubBlocksPerColumn);                  \
849                                                                                                    \
850         for(i = 0; i < i4NumSubBlocksPerColumn; i++)                                               \
851         {                                                                                          \
852             for(j = 0; j < i4NumSubBlocksPerRow; j++)                                              \
853             {                                                                                      \
854                 map[j + i * i4NumSubBlocksPerRow] = j + i * csbfBufStride;                         \
855             }                                                                                      \
856         }                                                                                          \
857     }
858 
859 #define COPY_CABAC_STATES(dest, src, size)                                                         \
860     {                                                                                              \
861         memcpy(dest, src, size);                                                                   \
862     }
863 
864 #define COPY_CABAC_STATES_FRM_CAB_COEFFX_PREFIX(dest, src, size)                                   \
865     {                                                                                              \
866         memcpy(dest, src, size);                                                                   \
867     }
868 
869 #define PAD_BUF(pu1_start, stride, wd, ht, p_x, p_y, plane, function_pointer1, function_pointer2)  \
870     {                                                                                              \
871         function_pointer1(pu1_start, stride, ht, wd, p_x);                                         \
872         function_pointer2((pu1_start) - (p_x), stride, ht, wd + ((p_x) << 1), p_y);                \
873     }
874 
875 #define PAD_BUF_HOR(pu1_start, stride, ht, p_x, p_y, function_pointer)                             \
876     {                                                                                              \
877         function_pointer(pu1_start, stride, ht, p_x);                                              \
878     }
879 
880 #define PAD_BUF_VER(pu1_start, stride, wd, p_x, p_y, function_pointer)                             \
881     {                                                                                              \
882         function_pointer(pu1_start, stride, wd, p_y);                                              \
883     }
884 
885 #define POPULATE_PART_RESULTS(ps_part_results, ps_search_node)                                     \
886     {                                                                                              \
887         ps_part_results->i1_ref_idx = ps_search_node->i1_ref_idx;                                  \
888         ps_part_results->i2_mv_x = ps_search_node->i2_mv_x;                                        \
889         ps_part_results->i2_mv_y = ps_search_node->i2_mv_y;                                        \
890         ps_part_results->i4_sad = ps_search_node->i4_sad;                                          \
891     }
892 
893 #define GET_IDX_CIRCULAR_BUF(idx, increment, size)                                                 \
894     {                                                                                              \
895         if(increment < 0)                                                                          \
896         {                                                                                          \
897             idx += increment;                                                                      \
898             if(idx < 0)                                                                            \
899             {                                                                                      \
900                 idx += size;                                                                       \
901             }                                                                                      \
902         }                                                                                          \
903         else                                                                                       \
904         {                                                                                          \
905             idx += increment;                                                                      \
906             if(idx >= size)                                                                        \
907             {                                                                                      \
908                 idx %= size;                                                                       \
909             }                                                                                      \
910         }                                                                                          \
911     }
912 
913 #define CLIPUCHAR(x) CLIP3((x), 0, 255)
914 
915 #define CLIPUCHAR10BIT(x) CLIP3((x), 0, 1023)
916 
917 #define CEIL4(x) (((x + 3) >> 2) << 2)
918 
919 #define CEIL8(x) (((x + 7) >> 3) << 3)
920 
921 #define CEIL2(x) (((x + 1) >> 1) << 1)
922 
923 #define CEIL16(x) (((x) + 15) & (~15))
924 
925 #define CEIL_POW2(x, align) (((x) + (align)-1) & (~((align)-1)))
926 
927 #define PAD_SUBPEL PAD_BUF
928 #define PAD_FPEL PAD_BUF
929 #define PAD_FPEL_HOR PAD_BUF_HOR
930 #define PAD_FPEL_VER PAD_BUF_VER
931 
932 /* Defining a printf macro: To disable all prints inside codec in release mode */
933 #ifdef _DEBUG
934 #define DBG_PRINTF(...) printf(__VA_ARGS__)
935 #else
936 #define DBG_PRINTF(...)
937 #endif
938 
939 /*****************************************************************************/
940 /* Enumerations                                                              */
941 /*****************************************************************************/
942 
943 typedef enum
944 {
945     LEVEL1 = 30,
946     LEVEL2 = 60,
947     LEVEL2_1 = 63,
948     LEVEL3 = 90,
949     LEVEL3_1 = 93,
950     LEVEL4 = 120,
951     LEVEL4_1 = 123,
952     LEVEL5 = 150,
953     LEVEL5_1 = 153,
954     LEVEL5_2 = 156,
955     LEVEL6 = 180,
956     LEVEL6_1 = 183,
957     LEVEL6_2 = 186
958 } LEVEL_T;
959 
960 typedef enum
961 {
962     LIST_0,
963     LIST_1,
964 
965     NUM_REF_LISTS
966 
967 } REF_LISTS_t;
968 
969 typedef enum SSD_TYPE_T
970 {
971     NULL_TYPE = -1,
972     SPATIAL_DOMAIN_SSD,
973     FREQUENCY_DOMAIN_SSD
974 
975 } SSD_TYPE_T;
976 
977 #endif
978