|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef _SLICE_H_ |
|
21 #define _SLICE_H_ |
|
22 |
|
23 |
|
24 #include "globals.h" |
|
25 #include "nrctyp32.h" |
|
26 #include "bitbuffer.h" |
|
27 #include "framebuffer.h" |
|
28 #include "motcomp.h" |
|
29 #include "parameterset.h" |
|
30 #include "dpb.h" |
|
31 #include <e32std.h> |
|
32 |
|
33 /* Error codes */ |
|
34 #define SLICE_ERR_NON_EXISTING_PPS -5 |
|
35 #define SLICE_ERR_NON_EXISTING_SPS -4 |
|
36 #define SLICE_ERR_UNSUPPORTED_FEATURE -3 |
|
37 #define SLICE_ERR_ILLEGAL_VALUE -2 |
|
38 #define SLICE_ERROR -1 |
|
39 #define SLICE_OK 0 |
|
40 #define SLICE_STOP_PARSING 1 |
|
41 #define SLICE_STOP_PARSING 1 |
|
42 |
|
43 #define MAX_SLICE_GROUP_NUM 8 |
|
44 #define MAX_NUM_OF_REORDER_CMDS 17 |
|
45 #define MAX_NUM_OF_MMCO_OPS 35 |
|
46 |
|
47 |
|
48 typedef struct _sliceMMCO_s { |
|
49 unsigned int memory_management_control_operation; |
|
50 unsigned int difference_of_pic_nums_minus1; |
|
51 unsigned int long_term_pic_num; |
|
52 unsigned int long_term_frame_idx; |
|
53 unsigned int max_long_term_frame_idx_plus1; |
|
54 } sliceMMCO_s; |
|
55 |
|
56 |
|
57 typedef struct _sliceRefPicListReorderCmd_s { |
|
58 unsigned int reordering_of_pic_nums_idc; |
|
59 unsigned int abs_diff_pic_num_minus1; |
|
60 unsigned int long_term_pic_num; |
|
61 } sliceRefPicListReorderCmd_s; |
|
62 |
|
63 |
|
64 |
|
65 typedef struct _slice_s { |
|
66 |
|
67 /* Copied from NAL deader */ |
|
68 int nalType; |
|
69 int nalRefIdc; |
|
70 |
|
71 u_int32 maxFrameNum; |
|
72 |
|
73 unsigned int isIDR; |
|
74 unsigned int qp; |
|
75 unsigned int picHasMMCO5; |
|
76 |
|
77 /* |
|
78 * These are slice header syntax elements |
|
79 */ |
|
80 |
|
81 unsigned int first_mb_in_slice; |
|
82 unsigned int slice_type; |
|
83 unsigned int pic_parameter_set_id; |
|
84 unsigned int frame_num; |
|
85 |
|
86 unsigned int idr_pic_id; |
|
87 |
|
88 unsigned int pic_order_cnt_lsb; |
|
89 int32 delta_pic_order_cnt_bottom; |
|
90 |
|
91 int32 delta_pic_order_cnt_0; |
|
92 int32 delta_pic_order_cnt_1; |
|
93 |
|
94 unsigned int redundant_pic_cnt; |
|
95 |
|
96 unsigned int num_ref_idx_active_override_flag; |
|
97 unsigned int num_ref_idx_l0_active_minus1; |
|
98 |
|
99 unsigned int ref_pic_list_reordering_flag0; |
|
100 sliceRefPicListReorderCmd_s reorderCmdList[MAX_NUM_OF_REORDER_CMDS]; |
|
101 |
|
102 /* pred_weight_table() */ |
|
103 |
|
104 /* if( nal_unit_type = = 5 ) */ |
|
105 unsigned int no_output_of_prior_pics_flag; |
|
106 unsigned int long_term_reference_flag; |
|
107 /* else */ |
|
108 unsigned int adaptive_ref_pic_marking_mode_flag; |
|
109 sliceMMCO_s mmcoCmdList[MAX_NUM_OF_MMCO_OPS]; |
|
110 |
|
111 int slice_qp_delta; |
|
112 |
|
113 unsigned int disable_deblocking_filter_idc; |
|
114 int slice_alpha_c0_offset_div2; |
|
115 int slice_beta_offset_div2; |
|
116 |
|
117 unsigned int slice_group_change_cycle; |
|
118 |
|
119 TInt bitOffset; |
|
120 TUint sliceDataModified; |
|
121 } slice_s; |
|
122 |
|
123 |
|
124 slice_s *sliceOpen(); |
|
125 |
|
126 void sliceClose(slice_s *slice); |
|
127 |
|
128 TInt ParseSliceHeader(slice_s *slice, seq_parameter_set_s *spsList[], |
|
129 pic_parameter_set_s *ppsList[], bitbuffer_s *bitbuf, |
|
130 TUint* frameNumber, TUint aFrameFromEncoder); |
|
131 |
|
132 TInt sliceParseMacroblocks(slice_s *slice, frmBuf_s *recoBuf, dpb_s *dpb, |
|
133 pic_parameter_set_s *pps, |
|
134 mbAttributes_s *mbData, TInt sliceID, |
|
135 bitbuffer_s *bitbuf, |
|
136 TBool aBitShiftInSlice); |
|
137 |
|
138 int sliceInitRefPicList(dpb_s *dpb, frmBuf_s *refPicList[]); |
|
139 |
|
140 int sliceFixRefPicList(dpb_s *dpb, frmBuf_s *refPicList[], |
|
141 int numRefPicActive, int numExistingRefFrames, |
|
142 int width, int height); |
|
143 |
|
144 void EncodeUnsignedNBits(bitbuffer_s *aBitBuffer, TUint aValue, TUint aLength); |
|
145 |
|
146 |
|
147 #endif |