blob: e54e4d3665ffc726addf251774d61637c00ecf1e
1 | /* |
2 | * drivers/amlogic/media_modules/amvdec_ports/decoder/h264_parse.h |
3 | * |
4 | * Copyright (C) 2017 Amlogic, Inc. All rights reserved. |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. |
10 | * |
11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
14 | * more details. |
15 | * |
16 | */ |
17 | |
18 | #ifndef _H264_PARSE_H |
19 | #define _H264_PARSE_H |
20 | |
21 | #include "h264_stream.h" |
22 | |
23 | enum color_model { |
24 | CM_UNKNOWN = -1, |
25 | CM_YUV = 0, |
26 | CM_RGB = 1, |
27 | CM_XYZ = 2 |
28 | }; |
29 | |
30 | enum color_format { |
31 | CF_UNKNOWN = -1, //!< Unknown color format |
32 | YUV400 = 0, //!< Monochrome |
33 | YUV420 = 1, //!< 4:2:0 |
34 | YUV422 = 2, //!< 4:2:2 |
35 | YUV444 = 3 //!< 4:4:4 |
36 | }; |
37 | |
38 | enum pixel_format { |
39 | PF_UNKNOWN = -1, //!< Unknown color ordering |
40 | UYVY = 0, //!< UYVY |
41 | YUY2 = 1, //!< YUY2 |
42 | YUYV = 1, //!< YUYV |
43 | YVYU = 2, //!< YVYU |
44 | BGR = 3, //!< BGR |
45 | V210 = 4 //!< Video Clarity 422 format (10 bits) |
46 | }; |
47 | |
48 | //AVC Profile IDC definitions |
49 | enum profile_idc{ |
50 | NO_PROFILE = 0, //!< disable profile checking for experimental coding (enables FRExt, but disables MV) |
51 | FREXT_CAVLC444 = 44, //!< YUV 4:4:4/14 "CAVLC 4:4:4" |
52 | BASELINE = 66, //!< YUV 4:2:0/8 "Baseline" |
53 | MAIN = 77, //!< YUV 4:2:0/8 "Main" |
54 | EXTENDED = 88, //!< YUV 4:2:0/8 "Extended" |
55 | FREXT_HP = 100, //!< YUV 4:2:0/8 "High" |
56 | FREXT_Hi10P = 110, //!< YUV 4:2:0/10 "High 10" |
57 | FREXT_Hi422 = 122, //!< YUV 4:2:2/10 "High 4:2:2" |
58 | FREXT_Hi444 = 244, //!< YUV 4:4:4/14 "High 4:4:4" |
59 | MVC_HIGH = 118, //!< YUV 4:2:0/8 "Multiview High" |
60 | STEREO_HIGH = 128 //!< YUV 4:2:0/8 "Stereo High" |
61 | }; |
62 | |
63 | /* sequence parameter set */ |
64 | struct h264_SPS_t { |
65 | bool vailid; |
66 | unsigned int profile_idc; |
67 | bool constrained_set0_flag; |
68 | bool constrained_set1_flag; |
69 | bool constrained_set2_flag; |
70 | bool constrained_set3_flag; |
71 | unsigned int level_idc; |
72 | unsigned int seq_parameter_set_id; |
73 | unsigned int chroma_format_idc; |
74 | bool seq_scaling_matrix_present_flag; |
75 | int seq_scaling_list_present_flag[12]; |
76 | int ScalingList4x4[6][16]; |
77 | int ScalingList8x8[6][64]; |
78 | bool UseDefaultScalingMatrix4x4Flag[6]; |
79 | bool UseDefaultScalingMatrix8x8Flag[6]; |
80 | unsigned int bit_depth_luma_minus8; |
81 | unsigned int bit_depth_chroma_minus8; |
82 | unsigned int log2_max_frame_num_minus4; |
83 | unsigned int pic_order_cnt_type; |
84 | unsigned int log2_max_pic_order_cnt_lsb_minus4; |
85 | bool delta_pic_order_always_zero_flag; |
86 | int offset_for_non_ref_pic; |
87 | int offset_for_top_to_bottom_field; |
88 | unsigned int num_ref_frames_in_poc_cycle; |
89 | int offset_for_ref_frame[255]; |
90 | int num_ref_frames; |
91 | bool gaps_in_frame_num_value_allowed_flag; |
92 | unsigned int pic_width_in_mbs_minus1; |
93 | unsigned int pic_height_in_map_units_minus1; |
94 | bool frame_mbs_only_flag; |
95 | bool mb_adaptive_frame_field_flag; |
96 | bool direct_8x8_inference_flag; |
97 | bool frame_cropping_flag; |
98 | unsigned int frame_crop_left_offset; |
99 | unsigned int frame_crop_right_offset; |
100 | unsigned int frame_crop_top_offset; |
101 | unsigned int frame_crop_bottom_offset; |
102 | bool vui_parameters_present_flag; |
103 | //h264_vui_parameters_t *vui_parameters; |
104 | unsigned separate_colour_plane_flag; |
105 | int lossless_qpprime_flag; |
106 | }; |
107 | |
108 | /* pic parameter set */ |
109 | struct h264_PPS_t { |
110 | int pic_parameter_set_id; |
111 | int seq_parameter_set_id; |
112 | int entropy_coding_mode_flag; |
113 | int pic_order_present_flag; |
114 | int num_slice_groups_minus1; |
115 | int slice_group_map_type; |
116 | int run_length_minus1; |
117 | int top_left; |
118 | int bottom_right; |
119 | int slice_group_change_direction_flag; |
120 | int slice_group_change_rate_minus1; |
121 | int pic_size_in_map_units_minus1; |
122 | int slice_group_id; |
123 | int num_ref_idx_l0_active_minus1; |
124 | int num_ref_idx_l1_active_minus1; |
125 | int weighted_pred_flag; |
126 | int weighted_bipred_idc; |
127 | int pic_init_qp_minus26; |
128 | int pic_init_qs_minus26; |
129 | int chroma_qp_index_offset; |
130 | int deblocking_filter_control_present_flag; |
131 | int constrained_intra_pred_flag; |
132 | int redundant_pic_cnt_present_flag; |
133 | }; |
134 | |
135 | void h264_sps_parse(struct h264_stream_t *s, struct h264_SPS_t *sps); |
136 | void h264_pps_parse(struct h264_stream_t *s, struct h264_PPS_t *pps); |
137 | |
138 | void h264_sps_info(struct h264_SPS_t *sps); |
139 | void h264_pps_info(struct h264_PPS_t *pps); |
140 | |
141 | #endif //_H264_PARSE_H |
142 |