xref: /aosp_15_r20/external/libavc/common/ih264_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_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 
38 #ifndef _IH264_DEFS_H_
39 #define _IH264_DEFS_H_
40 
41 /*****************************************************************************/
42 /* Enums                                                                     */
43 /*****************************************************************************/
44 
45 
46 /*****************************************************************************/
47 /* Profile and Levels                                                        */
48 /*****************************************************************************/
49 
50 /**
51 ******************************************************************************
52  *  @enum  PROFILE_IDC
53  *  @brief Defines the set of possible profiles
54 ******************************************************************************
55 */
56 enum
57 {
58     IH264_PROFILE_BASELINE = 66,
59     IH264_PROFILE_MAIN = 77,
60     IH264_PROFILE_EXTENDED = 88,
61     IH264_PROFILE_HIGH = 100,
62     IH264_PROFILE_HIGH10 = 110,
63     IH264_PROFILE_HIGH422 = 122,
64     IH264_PROFILE_HIGH444 = 144,
65 };
66 
67 /**
68 ******************************************************************************
69  *  @enum  LEVEL_IDC
70  *  @brief Defines the set of possible levels
71 ******************************************************************************
72 */
73 typedef enum
74 {
75     IH264_LEVEL_10         = 10,
76     IH264_LEVEL_1B         = 9,
77     IH264_LEVEL_11         = 11,
78     IH264_LEVEL_12         = 12,
79     IH264_LEVEL_13         = 13,
80     IH264_LEVEL_20         = 20,
81     IH264_LEVEL_21         = 21,
82     IH264_LEVEL_22         = 22,
83     IH264_LEVEL_30         = 30,
84     IH264_LEVEL_31         = 31,
85     IH264_LEVEL_32         = 32,
86     IH264_LEVEL_40         = 40,
87     IH264_LEVEL_41         = 41,
88     IH264_LEVEL_42         = 42,
89     IH264_LEVEL_50         = 50,
90     IH264_LEVEL_51         = 51,
91 }IH264_LEVEL_T;
92 
93 
94 /**
95 ******************************************************************************
96  *  @enum  PIC TYPES
97  *  @brief Defines the set of possible picture type - not signaled in bitstream
98 ******************************************************************************
99 */
100 typedef enum
101 {
102     PIC_NA = 0x7FFFFFFF,
103     PIC_IDR = 0,
104     PIC_I = 1,
105     PIC_P = 2,
106     PIC_B = 3,
107     PIC_P_NONREF = 4,
108     PIC_B_NONREF = 5,
109     PIC_MAX,
110 }PIC_TYPE_T;
111 
112 /**
113 ******************************************************************************
114  *  @enum  FRAME-FIELD types
115  *  @brief Defines the set of possible field types.
116 ******************************************************************************
117 */
118 enum
119 {
120     TOP_FIELD,
121     BOTTOM_FIELD,
122     FRAME,
123 };
124 
125 /**
126 ******************************************************************************
127  *  @enum  SLICE TYPES
128  *  @brief Defines the set of possible SLICE TYPES
129 ******************************************************************************
130 */
131 enum
132 {
133     PSLICE = 0,
134     BSLICE = 1,
135     ISLICE = 2,
136     SPSLICE = 3,
137     SISLICE = 4,
138     EPSLICE = 5,
139     EBSLICE = 6,
140     EISLICE = 7,
141     MAXSLICE_TYPE,
142 };
143 
144 /**
145 ******************************************************************************
146  *  @enum  NAL_UNIT_TYPE
147  *  @brief Defines the set of possible nal unit types
148 ******************************************************************************
149 */
150 typedef enum NAL_UNIT_TYPE_T
151 {
152     NAL_UNSPEC_0 = 0,
153     NAL_SLICE_NON_IDR = 1,
154     NAL_SLICE_DPA = 2,
155     NAL_SLICE_DPB = 3,
156     NAL_SLICE_DPC = 4,
157     NAL_SLICE_IDR = 5,
158     NAL_SEI = 6,
159     NAL_SPS = 7,
160     NAL_PPS = 8,
161     NAL_AUD = 9,
162     NAL_EOSEQ = 10,
163     NAL_EOSTR = 11,
164     NAL_FILLER = 12,
165     NAL_SPSE = 13,
166     NAL_PREFIX = 14,
167     NAL_SUBSET_SPS = 15,
168     NAL_AUX_PIC = 19,
169     NAL_CODED_SLICE_EXTENSION = 20,
170     NAL_UNSPEC_31 = 24,
171 } NAL_UNIT_TYPE_T;
172 
173 /**
174 ******************************************************************************
175  *  @enum  CHROMA_FORMAT_IDC
176  *  @brief Defines the set of possible chroma formats
177  *  Note Chorma format Do not change enum values
178 ******************************************************************************
179 */
180 enum
181 {
182     CHROMA_FMT_IDC_MONOCHROME   = 0,
183     CHROMA_FMT_IDC_YUV420       = 1,
184     CHROMA_FMT_IDC_YUV422       = 2,
185     CHROMA_FMT_IDC_YUV444       = 3,
186     CHROMA_FMT_IDC_YUV444_PLANES = 4,
187 };
188 
189 
190 /**
191 ******************************************************************************
192  *  @enum  MBMODES_I16x16
193  *  @brief Defines the set of possible intra 16x16 mb modes
194 ******************************************************************************
195 */
196 typedef enum
197 {
198     VERT_I16x16     = 0,
199     HORZ_I16x16     = 1,
200     DC_I16x16       = 2,
201     PLANE_I16x16    = 3,
202     MAX_I16x16      = 4,
203 }MBMODES_I16x16;
204 
205 /**
206 ******************************************************************************
207  *  @enum  MBMODES_I4x4
208  *  @brief Defines the set of possible intra 4x4 mb modes
209 ******************************************************************************
210 */
211 typedef enum
212 {
213     VERT_I4x4     = 0,
214     HORZ_I4x4     = 1,
215     DC_I4x4       = 2,
216     DIAG_DL_I4x4  = 3,
217     DIAG_DR_I4x4  = 4,
218     VERT_R_I4x4   = 5,
219     HORZ_D_I4x4   = 6,
220     VERT_L_I4x4   = 7,
221     HORZ_U_I4x4   = 8,
222     MAX_I4x4      = 9,
223 }MBMODES_I4x4;
224 
225 /**
226 ******************************************************************************
227  *  @enum  MBMODES_I8x8
228  *  @brief Defines the set of possible intra 8x8 mb modes
229 ******************************************************************************
230 */
231 typedef enum
232 {
233     VERT_I8x8     = 0,
234     HORZ_I8x8     = 1,
235     DC_I8x8       = 2,
236     DIAG_DL_I8x8  = 3,
237     DIAG_DR_I8x8  = 4,
238     VERT_R_I8x8   = 5,
239     HORZ_D_I8x8   = 6,
240     VERT_L_I8x8   = 7,
241     HORZ_U_I8x8   = 8,
242     MAX_I8x8      = 9,
243 }MBMODES_I8x8;
244 
245 /**
246 ******************************************************************************
247  *  @enum  MBMODES_CHROMA_I8x8 (Chroma)
248  *  @brief Defines the set of possible intra 8x8 mb modes for chroma
249 ******************************************************************************
250 */
251 typedef enum
252 {
253     DC_CH_I8x8     = 0,
254     HORZ_CH_I8x8   = 1,
255     VERT_CH_I8x8   = 2,
256     PLANE_CH_I8x8  = 3,
257     MAX_CH_I8x8    = 4,
258 }MBMODES_CHROMA_I8x8;
259 
260 /**
261 ******************************************************************************
262  *  @enum  MBTYPES
263  *  @brief Defines the set of possible macro block types
264 ******************************************************************************
265 */
266 typedef enum
267 {
268     INVALID_MB_TYPE = -1,
269     I16x16 = 0,
270     I4x4 = 1,
271     I8x8 = 2,
272     P16x16 = 3,
273     P16x8 = 4,
274     P8x16 = 5,
275     P8x8 = 6,
276     PSKIP = 7,
277     IPCM = 8,
278     B16x16 = 9,
279     BSKIP = 10,
280     BDIRECT = 11,
281     BASE_MODE = 12,
282     MAX_MBTYPES,
283 } MBTYPES_T;
284 
285 /* Pred Modes */
286 enum
287 {
288     BLOCK_TYPE_INTER_MB = 0,
289     BLOCK_TYPE_INTRA_MB = 1,
290     BLOCK_TYPE_SKIP_MB = 2
291 };
292 
293 /* Prediction list */
294 /* Do not change enum values */
295 enum
296 {
297     PRED_L0 = 0,
298     PRED_L1 = 1,
299     PRED_BI = 2
300 };
301 
302 
303 /**
304 ******************************************************************************
305  *  @enum  ENTROPY_BLK_TYPE
306  *  @brief Defines the nature of blocks employed in entropy coding
307 ******************************************************************************
308 */
309 typedef enum
310 {
311     ENTROPY_BLK_INVALID = -1,
312     CAVLC_LUMA_4x4_DC = 0,
313     CAVLC_LUMA_4x4_AC = 1,
314     CAVLC_LUMA_4x4 = 2,
315     CAVLC_CHROMA_4x4_DC = 3,
316     CAVLC_CHROMA_4x4_AC = 4,
317 } ENTROPY_BLK_TYPE;
318 
319 /**
320 ******************************************************************************
321  *  @enum  ENTROPY_MODE
322  *  @brief Entropy coding modes
323 ******************************************************************************
324 */
325 typedef enum
326 {
327     CAVLC = 0,
328     CABAC = 1,
329 } ENTROPY_MODE;
330 
331 /**
332 ******************************************************************************
333  *  @enum  COMPONENT_TYPE
334  *  @brief components Y, U & V
335 ******************************************************************************
336 */
337 typedef enum
338 {
339     Y,
340     U,
341     V,
342 } COMPONENT_TYPE;
343 
344 
345 /**
346 ******************************************************************************
347  *  @enum  MBPART_PREDMODE_T
348  *  @brief MbPartps_pred_mode_ctxt Table 7-11 to 7-14
349 ******************************************************************************
350 */
351 typedef enum
352 {
353     MBPART_NA,
354     MBPART_I4x4,
355     MBPART_I8x8,
356     MBPART_I16x16,
357     MBPART_L0,
358     MBPART_L1,
359     MBPART_BI,
360     MBPART_DIRECT,
361     MBPART_IPCM,
362 }MBPART_PREDMODE_T;
363 
364 
365 typedef enum
366 {
367     I_NxN,
368     I_16x16_0_0_0,
369     I_16x16_1_0_0,
370     I_16x16_2_0_0,
371     I_16x16_3_0_0,
372     I_16x16_0_1_0,
373     I_16x16_1_1_0,
374     I_16x16_2_1_0,
375     I_16x16_3_1_0,
376     I_16x16_0_2_0,
377     I_16x16_1_2_0,
378     I_16x16_2_2_0,
379     I_16x16_3_2_0,
380     I_16x16_0_0_1,
381     I_16x16_1_0_1,
382     I_16x16_2_0_1,
383     I_16x16_3_0_1,
384     I_16x16_0_1_1,
385     I_16x16_1_1_1,
386     I_16x16_2_1_1,
387     I_16x16_3_1_1,
388     I_16x16_0_2_1,
389     I_16x16_1_2_1,
390     I_16x16_2_2_1,
391     I_16x16_3_2_1,
392     I_PCM,
393 }MBTYPE_ISLICE_T;
394 
395 typedef enum
396 {
397     P_L0_16x16,
398     P_L0_L0_16x8,
399     P_L0_L0_8x16,
400     P_8x8,
401     P_8x8REF0,
402     P_SKIP
403 }MBTYPE_PSLICE_T;
404 
405 typedef enum
406 {
407     B_DIRECT_16x16,
408     B_L0_16x16,
409     B_L1_16x16,
410     B_BI_16x16,
411     B_L0_L0_16x8,
412     B_L0_L0_8x16,
413     B_L1_L1_16x8,
414     B_L1_L1_8x16,
415     B_L0_L1_16x8,
416     B_L0_L1_8x16,
417     B_L1_L0_16x8,
418     B_L1_L0_8x16,
419     B_L0_BI_16x8,
420     B_L0_BI_8x16,
421     B_L1_BI_16x8,
422     B_L1_BI_8x16,
423     B_BI_L0_16x8,
424     B_BI_L0_8x16,
425     B_BI_L1_16x8,
426     B_BI_L1_8x16,
427     B_BI_BI_16x8,
428     B_BI_BI_8x16,
429     B_8x8,
430     B_SKIP,
431 }MBTYPE_BSLICE_T;
432 
433 
434 typedef enum
435 {
436     P_L0_8x8,
437     P_L0_8x4,
438     P_L0_4x8,
439     P_L0_4x4,
440 }SUBMBTYPE_PSLICE_T;
441 
442 typedef enum
443 {
444     B_DIRECT_8x8,
445     B_L0_8x8,
446     B_L1_8x8,
447     B_BI_8x8,
448     B_L0_8x4,
449     B_L0_4x8,
450     B_L1_8x4,
451     B_L1_4x8,
452     B_BI_8x4,
453     B_BI_4x8,
454     B_L0_4x4,
455     B_L1_4x4,
456     B_BI_4x4,
457 }SUBMBTYPE_BSLICE_T;
458 
459 /*****************************************************************************/
460 /* Constant Macros                                                           */
461 /*****************************************************************************/
462 
463 /**
464  * DC Mode pattern for 4 4x4 sub blocks in an MB row
465  */
466 #define DC_I16X16_MB_ROW (DC_I16x16 << 24) | (DC_I16x16 << 16) | \
467                          (DC_I16x16 << 8)  | DC_I16x16
468 
469 /*****************************************************************************/
470 /* Reference frame defs                                                      */
471 /*****************************************************************************/
472 /* Maximum DPB size */
473 #define MAX_DPB_SIZE 16
474 
475 /* Maximum mmco commands in slice header */
476 #define MAX_MMCO_COMMANDS 32
477 
478 /* Maximum reference reorder idc */
479 #define MAX_MODICATION_IDC 32
480 
481 /*****************************************************************************/
482 /* SPS restrictions                                                          */
483 /*****************************************************************************/
484 
485 /* Number of SPS allowed */
486 /* An extra buffer is allocated to write the parsed data
487  * It is copied to the appropriate location later */
488 #define MAX_SPS_CNT         (32 + 1)
489 
490 /* Maximum long term reference pics */
491 #define MAX_LTREF_PICS_SPS 16
492 
493 /* Maximum short term reference pics */
494 #define MAX_STREF_PICS_SPS 64
495 
496 
497 /*****************************************************************************/
498 /* PPS restrictions                                                          */
499 /*****************************************************************************/
500 
501 /* Number of PPS allowed  */
502 /* An extra buffer is allocated to write the parsed data
503  * It is copied to the appropriate location later */
504 #define MAX_PPS_CNT         (256 + 1)
505 
506 /*****************************************************************************/
507 /* Macro definitions for sizes of MB, PU, TU, CU                            */
508 /*****************************************************************************/
509 #define MB_SIZE             16
510 #define BLK8x8SIZE          8
511 #define BLK_SIZE            4
512 
513 
514 /* TU Size Range */
515 #define MAX_TU_SIZE         8
516 #define MIN_TU_SIZE         4
517 
518 /* Max Transform Size */
519 #define MAX_TRANS_SIZE      (MAX_TU_SIZE*MAX_TU_SIZE)
520 
521 /* PU Size Range */
522 #define MAX_PU_SIZE         16
523 #define MIN_PU_SIZE         4
524 
525 /* Number of max TU in a MB row */
526 #define MAX_TU_IN_MB_ROW   ((MB_SIZE / MIN_TU_SIZE))
527 
528 #define MIN_TU_IN_MB_ROW ((MB_SIZE / MAX_TU_SIZE))
529 
530 /* Number of max PU in a CTb row */
531 #define MAX_PU_IN_MB_ROW   ((MB_SIZE / MIN_PU_SIZE))
532 
533 #define MAX_TU_IN_MB_COL MAX_TU_IN_MB_ROW
534 
535 #define MIN_TU_IN_MB_COL MIN_TU_IN_MB_ROW
536 
537 #define MAX_PU_IN_MB_COL MAX_PU_IN_MB_ROW
538 
539 /* Number of max PU in a MB */
540 /*****************************************************************************/
541 /* Note though for 64 x 64 MB, Max PU in MB is 128, in order to store        */
542 /*  intra pred info, 256 entries are needed                                  */
543 /*****************************************************************************/
544 #define MAX_PU_IN_MB       ((MB_SIZE / MIN_PU_SIZE) * \
545                              (MB_SIZE / MIN_PU_SIZE))
546 
547 /* Number of max TU in a MB */
548 #define MAX_TU_IN_MB       ((MB_SIZE / MIN_TU_SIZE) * \
549                              (MB_SIZE / MIN_TU_SIZE))
550 
551 #define MIN_TU_IN_MB (MIN_TU_IN_MB_ROW * MIN_TU_IN_MB_COL)
552 
553 #define NUM_4x4_IN_8x8 4
554 
555 #define NUM_COEFFS_IN_MIN_TU (MIN_TU_SIZE * MIN_TU_SIZE)
556 
557 /**
558  * Maximum transform depths
559  */
560 #define MAX_TRAFO_DEPTH 5
561 
562 #define MAX_DC_4x4_SUBBLK_LUMA 1
563 #define MAX_AC_4x4_SUBBLK_LUMA 16
564 #define MAX_DC_4x4_SUBBLK_CHROMA 2
565 #define MAX_AC_4x4_SUBBLK_CHROMA 8
566 
567 #define MAX_4x4_SUBBLKS (MAX_DC_4x4_SUBBLK_LUMA + MAX_DC_4x4_SUBBLK_CHROMA +\
568                          MAX_AC_4x4_SUBBLK_LUMA + MAX_AC_4x4_SUBBLK_CHROMA)
569 
570 /* Max number of deblocking edges */
571 #define MAX_VERT_DEBLK_EDGES ((MB_SIZE/8) * (MB_SIZE/4))
572 #define MAX_HORZ_DEBLK_EDGES ((MB_SIZE/4) * (MB_SIZE/8))
573 
574 /* Qp can not change below 8x8 level */
575 #define MAX_DEBLK_QP_CNT     ((MB_SIZE/8) * (MB_SIZE/8))
576 
577 /*****************************************************************************/
578 /* Parsing related macros                                                    */
579 /*****************************************************************************/
580 #define SUBBLK_COEFF_CNT    16
581 
582 /* Quant and Trans defs */
583 
584 /*****************************************************************************/
585 /* Sizes for Transform functions                                             */
586 /*****************************************************************************/
587 #define TRANS_SIZE_4   4
588 #define TRANS_SIZE_8   8
589 #define TRANS_SIZE_16 16
590 #define TRANS_SIZE_32 32
591 
592 
593 #define IT_SHIFT_STAGE_1 7
594 #define IT_SHIFT_STAGE_2 12
595 
596 /**
597  * @breif  Maximum transform dynamic range (excluding sign bit)
598  */
599 #define MAX_TR_DYNAMIC_RANGE  15
600 
601 /**
602  * @brief  Q(QP%6) * IQ(QP%6) = 2^20
603  */
604 #define QUANT_IQUANT_SHIFT    20
605 
606 /**
607  * @breif Q factor for Qp%6 multiplication
608  */
609 #define QUANT_SHIFT           14
610 
611 /**
612  * @breif Q shift factor for flat rescale matrix weights
613  */
614 #define FLAT_RESCALE_MAT_Q_SHIFT    11
615 
616 /**
617  * @breif  Scaling matrix is represented in Q15 format
618  */
619 #define SCALING_Q_SHIFT       15
620 
621 /**
622  * @brief  rounding factor for quantization represented in Q9 format
623  */
624 #define QUANT_ROUND_FACTOR_Q   9
625 
626 /**
627  * @brief  Minimum qp supported in H264 spec
628  */
629 #define MIN_H264_QP 0
630 
631 /**
632  * @brief  Maximum qp supported in H264 spec
633  */
634 #define MAX_H264_QP 51
635 
636 /**
637  * @brief  Minimum delta scale supported in H264 spec
638  */
639 #define MIN_H264_DELTA_SCALE (-128)
640 
641 /**
642  * @brief  Maximum delta scale supported in H264 spec
643  */
644 #define MAX_H264_DELTA_SCALE 127
645 
646 /**
647  * @breif  Total number of transform sizes
648  * used for sizeID while getting scale matrix
649  */
650 #define NUM_UNIQUE_TRANS_SIZE 4
651 
652 /**
653  * @breif  Maximum number of bits in frameNumber signaling
654  */
655 #define MAX_BITS_IN_FRAME_NUM     16
656 
657 /**
658  * @breif  Maximum number of bits in POC LSB signaling
659  */
660 #define MAX_BITS_IN_POC_LSB     16
661 
662 
663 /**
664  * @breif  Maximum PIC Order Count type
665  */
666 #define MAX_PIC_ORDER_COUNT_TYPE    2
667 
668 
669 /**
670  * @breif  Maximum Weighted bipred idc
671  */
672 #define MAX_WEIGHT_BIPRED_IDC 2
673 
674 /*****************************************************************************/
675 /* Number of scaling matrices for each transform size                        */
676 /*****************************************************************************/
677 #define SCALE_MAT_CNT_TRANS_SIZE_4    6
678 #define SCALE_MAT_CNT_TRANS_SIZE_8    6
679 #define SCALE_MAT_CNT_TRANS_SIZE_16   6
680 #define SCALE_MAT_CNT_TRANS_SIZE_32   2
681 
682 /* Maximum number of scale matrices for a given transform size */
683 #define SCALE_MAT_CNT_MAX_PER_TRANS_SIZE 6
684 
685 /* Total number of scale matrices */
686 #define TOTAL_SCALE_MAT_COUNT   (SCALE_MAT_CNT_TRANS_SIZE_4     + \
687                                  SCALE_MAT_CNT_TRANS_SIZE_8     + \
688                                  SCALE_MAT_CNT_TRANS_SIZE_16    + \
689                                  SCALE_MAT_CNT_TRANS_SIZE_32)
690 
691 
692 /*****************************************************************************/
693 /* Intra pred Macros                                                         */
694 /*****************************************************************************/
695 /** Planar Intra prediction mode */
696 #define INTRA_PLANAR             0
697 
698 /** DC Intra prediction mode */
699 #define INTRA_DC                 1
700 
701 /** Gives angular mode for intra prediction */
702 #define INTRA_ANGULAR(x) (x)
703 
704 /** Following is used to signal no intra prediction in case of pcm blocks
705  */
706 #define INTRA_PRED_NONE  63
707 
708 
709 /** Following is used to signal no intra prediction is needed for first three
710  * 4x4 luma blocks in case of 4x4 TU sizes
711  * Also used in pcm cases
712  */
713 #define INTRA_PRED_CHROMA_IDX_NONE  7
714 
715 
716 /**
717 ******************************************************************************
718  *  @brief  neighbor availability masks
719 ******************************************************************************
720  */
721 #define LEFT_MB_AVAILABLE_MASK      0x01
722 #define TOP_LEFT_MB_AVAILABLE_MASK  0x02
723 #define TOP_MB_AVAILABLE_MASK       0x04
724 #define TOP_RIGHT_MB_AVAILABLE_MASK 0x08
725 
726 /**
727 ******************************************************************************
728  *  @brief  SEI macros
729 ******************************************************************************
730  */
731 /*
732  * @brief  specifies the number of colour primary components of the mastering display
733  */
734 #define NUM_SEI_MDCV_PRIMARIES      3
735 
736 /*
737  * @brief  specifies the number of colour primary components of the nominal content colour volume
738  */
739 #define NUM_SEI_CCV_PRIMARIES       3
740 
741 #define DISPLAY_PRIMARIES_X_UPPER_LIMIT                37000
742 #define DISPLAY_PRIMARIES_X_LOWER_LIMIT                5
743 #define DISPLAY_PRIMARIES_X_DIVISION_FACTOR            5
744 
745 #define DISPLAY_PRIMARIES_Y_UPPER_LIMIT                42000
746 #define DISPLAY_PRIMARIES_Y_LOWER_LIMIT                5
747 #define DISPLAY_PRIMARIES_Y_DIVISION_FACTOR            5
748 
749 #define WHITE_POINT_X_UPPER_LIMIT                      37000
750 #define WHITE_POINT_X_LOWER_LIMIT                      5
751 #define WHITE_POINT_X_DIVISION_FACTOR                  5
752 
753 #define WHITE_POINT_Y_UPPER_LIMIT                      42000
754 #define WHITE_POINT_Y_LOWER_LIMIT                      5
755 #define WHITE_POINT_Y_DIVISION_FACTOR                  5
756 
757 #define MAX_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT        100000000
758 #define MAX_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT        50000
759 #define MAX_DISPLAY_MASTERING_LUMINANCE_DIVISION_FACTOR    10000
760 
761 #define MIN_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT        50000
762 #define MIN_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT        1
763 
764 #define AMBIENT_LIGHT_X_UPPER_LIMIT        50000
765 #define AMBIENT_LIGHT_Y_UPPER_LIMIT        50000
766 
767 #define CCV_PRIMARIES_X_UPPER_LIMIT        5000000
768 #define CCV_PRIMARIES_X_LOWER_LIMIT        -5000000
769 #define CCV_PRIMARIES_Y_UPPER_LIMIT        5000000
770 #define CCV_PRIMARIES_Y_LOWER_LIMIT        -5000000
771 
772 #define RSD_MAX 255
773 #define RSD_MIN -255
774 #define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
775 
776 #define SII_MAX_SUB_LAYERS 8
777 #define SII_SUB_LAYER_IDX 0
778 #define SHUTTER_INTERVAL_INFO_PRESENT_FLAG 1
779 #define SII_TIME_SCALE 24000000
780 #define FIXED_SHUTTER_INTERVAL_WITHIN_CVS_FLAG 0
781 #define SII_NUM_UNITS_IN_SHUTTER_INTERVAL 480000
782 #define SII_MAX_SUB_LAYERS_MINUS1 (SII_MAX_SUB_LAYERS - 1)
783 #define SUB_LAYER_NUM_UNITS_IN_SHUTTER_INTERVAL_HFR 480000
784 #define SUB_LAYER_NUM_UNITS_IN_SHUTTER_INTERVAL_SFR 240000
785 
786 /*
787  * @brief Below macros related to film grain characteristics SEI
788  */
789 #define SEI_FGC_NUM_COLOUR_COMPONENTS 3
790 #define SEI_FGC_MAX_NUM_MODEL_VALUES 6
791 #define SEI_FGC_MAX_NUM_INTENSITY_INTERVALS 256
792 
793 #endif /* _IH264_DEFS_H_ */
794