• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Name         : irc_cbr_buffer_control.h                             */
24 /*                                                                           */
25 /*  Description       : This file contains all the necessary declarations    */
26 /*                      for cbr_buffer_control functions                     */
27 /*                                                                           */
28 /*                                                                           */
29 /*  List of Functions : <List the functions defined in this file>            */
30 /*                                                                           */
31 /*  Issues / Problems : None                                                 */
32 /*                                                                           */
33 /*  Revision History  :                                                      */
34 /*                                                                           */
35 /*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
36 /*         06 05 2008   Ittiam          Draft                                */
37 /*                                                                           */
38 /*****************************************************************************/
39 
40 #ifndef CBR_BUFFER_CONTROL_H
41 #define CBR_BUFFER_CONTROL_H
42 
43 /* Macro for clipping a number between to extremes */
44 #define CLIP(Number,Max,Min)    if((Number) > (Max)) (Number) = (Max); \
45                                 else if((Number) < (Min)) (Number) = (Min);
46 /*****************************************************************************/
47 /* Structure                                                                 */
48 /*****************************************************************************/
49 typedef struct cbr_buffer_t *cbr_buffer_handle;
50 
51 WORD32 irc_cbr_buffer_num_fill_use_free_memtab(cbr_buffer_handle *pps_cbr_buffer,
52                                                itt_memtab_t *ps_memtab,
53                                                ITT_FUNC_TYPE_E e_func_type);
54 
55 /* Initialize the cbr Buffer*/
56 void irc_init_cbr_buffer(cbr_buffer_handle ps_cbr_buffer,
57                          WORD32 i4_buffer_delay,
58                          WORD32 i4_tgt_frm_rate,
59                          WORD32 *i4_bit_rate,
60                          UWORD32 *u4_num_pics_in_delay_prd,
61                          UWORD32 u4_vbv_buf_size);
62 
63 /* Check for tgt bits with in CBR buffer*/
64 WORD32 irc_cbr_buffer_constraint_check(cbr_buffer_handle ps_cbr_buffer,
65                                        WORD32 i4_tgt_bits,
66                                        picture_type_e e_pic_type);
67 
68 /* Get the buffer status with the current consumed bits*/
69 vbv_buf_status_e irc_get_cbr_buffer_status(cbr_buffer_handle ps_cbr_buffer,
70                                            WORD32 i4_tot_consumed_bits,
71                                            WORD32 *pi4_num_bits_to_prevent_overflow,
72                                            picture_type_e e_pic_type);
73 
74 /* Update the CBR buffer at the end of the VOP*/
75 void irc_update_cbr_buffer(cbr_buffer_handle ps_cbr_buffer,
76                            WORD32 i4_tot_consumed_bits,
77                            picture_type_e e_pic_type);
78 
79 /*Get the bits needed to stuff in case of Underflow*/
80 WORD32 irc_get_cbr_bits_to_stuff(cbr_buffer_handle ps_cbr_buffer,
81                                  WORD32 i4_tot_consumed_bits,
82                                  picture_type_e e_pic_type);
83 
84 WORD32 irc_get_cbr_buffer_delay(cbr_buffer_handle ps_cbr_buffer);
85 
86 WORD32 irc_get_cbr_buffer_size(cbr_buffer_handle ps_cbr_buffer);
87 
88 WORD32 irc_vbr_stream_buffer_constraint_check(cbr_buffer_handle ps_cbr_buffer,
89                                               WORD32 i4_tgt_bits,
90                                               picture_type_e e_pic_type);
91 
92 void irc_change_cbr_vbv_bit_rate(cbr_buffer_handle ps_cbr_buffer,
93                                  WORD32 *i4_bit_rate);
94 
95 void irc_change_cbr_vbv_tgt_frame_rate(cbr_buffer_handle ps_cbr_buffer,
96                                        WORD32 i4_tgt_frm_rate);
97 
98 void irc_change_cbr_vbv_num_pics_in_delay_period(cbr_buffer_handle ps_cbr_buffer,
99                                                  UWORD32 *u4_num_pics_in_delay_prd);
100 
101 void irc_change_cbr_buffer_delay(cbr_buffer_handle ps_cbr_buffer,
102                                  WORD32 i4_buffer_delay);
103 #endif /* CBR_BUFFER_CONTROL_H */
104 
105