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 #ifndef _PIC_HANDLING_H_
22 #define _PIC_HANDLING_H_
23 
24 /*
25  * Basic Understanding:
26  * irc_add_pic_to_stack(_re_enc):
27  * This functions converts the input (or display) order to encoding order
28  * */
29 typedef struct pic_handling_t *pic_handling_handle;
30 
31 WORD32 irc_pic_handling_num_fill_use_free_memtab(pic_handling_handle *pps_pic_handling,
32                                                  itt_memtab_t *ps_memtab,
33                                                  ITT_FUNC_TYPE_E e_func_type);
34 
35 void irc_init_pic_handling(pic_handling_handle ps_pic_handling,
36                            WORD32 i4_intra_frm_int,
37                            WORD32 i4_inter_frm_int,
38                            WORD32 i4_max_inter_frm_int,
39                            WORD32 i4_is_gop_closed);
40 
41 void irc_add_pic_to_stack(pic_handling_handle ps_pic_handling,
42                           WORD32 i4_enc_pic_id);
43 
44 WORD32 irc_add_pic_to_stack_re_enc(pic_handling_handle ps_pic_handling,
45                                    WORD32 i4_enc_pic_id,
46                                    picture_type_e e_pic_type);
47 
48 void irc_get_pic_from_stack(pic_handling_handle ps_pic_handling,
49                             WORD32 *pi4_pic_id,
50                             WORD32 *pi4_pic_disp_order_no,
51                             picture_type_e *pe_pic_type);
52 
53 WORD32 irc_is_last_frame_in_gop(pic_handling_handle ps_pic_handling);
54 
55 void irc_flush_frame_from_pic_stack(pic_handling_handle ps_pic_handling);
56 
57 /* NITT TBR The below two functions should be made a single function */
58 void irc_skip_encoded_frame(pic_handling_handle ps_pic_handling,
59                             picture_type_e e_pic_type);
60 
61 void irc_update_pic_handling(pic_handling_handle ps_pic_handling,
62                              picture_type_e e_pic_type);
63 
64 /*
65  * Function returns the number of frames that have been encoded in the GOP in
66  * which the force I frame takes impact
67  */
68 WORD32 irc_pic_type_get_frms_in_gop_force_I_frm(pic_handling_handle ps_pic_handling);
69 
70 void irc_set_force_I_frame_flag(pic_handling_handle ps_pic_handling);
71 
72 WORD32 irc_get_forced_I_frame_cur_frm_flag(pic_handling_handle ps_pic_handling);
73 
74 void irc_reset_forced_I_frame_cur_frm_flag(pic_handling_handle ps_pic_handling);
75 
76 /* Normal get functions */
77 WORD32 irc_pic_type_get_inter_frame_interval(pic_handling_handle ps_pic_handling);
78 
79 WORD32 irc_pic_type_get_intra_frame_interval(pic_handling_handle ps_pic_handling);
80 
81 WORD32 irc_pic_type_get_disp_order_no(pic_handling_handle ps_pic_handling);
82 
83 void irc_pic_handling_register_new_int_frm_interval(pic_handling_handle ps_pic_handling,
84                                                     WORD32 i4_intra_frm_int);
85 
86 void irc_pic_handling_register_new_inter_frm_interval(pic_handling_handle ps_pic_handling,
87                                                       WORD32 i4_inter_frm_int);
88 
89 void irc_pic_type_get_rem_frms_in_gop(pic_handling_handle ps_pic_handling,
90                                       WORD32 ai4_rem_frms_in_gop[MAX_PIC_TYPE]);
91 
92 void irc_pic_type_get_frms_in_gop(pic_handling_handle ps_pic_handling,
93                                   WORD32 ai4_frms_in_gop[MAX_PIC_TYPE]);
94 
95 #endif /* _PIC_HANDLING_H_ */
96 
97