1 #ifndef VIDDEC_PM_COMMON_LIST_H 2 #define VIDDEC_PM_COMMON_LIST_H 3 4 #include "viddec_emitter.h" 5 6 /* Limitation:This is the maximum numbers of es buffers between start codes. Needs to change if we encounter 7 a case if this is not sufficent */ 8 #ifdef VBP 9 #define MAX_IBUFS_PER_SC 512 10 #else 11 #define MAX_IBUFS_PER_SC 64 12 #endif 13 14 /* This structure is for storing information on byte position in the current access unit. 15 stpos is the au byte index of first byte in current es buffer.edpos is the au byte index+1 of last 16 valid byte in current es buffer.*/ 17 typedef struct 18 { 19 uint32_t stpos; 20 uint32_t edpos; 21 }viddec_pm_utils_au_bytepos_t; 22 23 /* this structure is for storing all necessary information for list handling */ 24 typedef struct 25 { 26 uint16_t num_items; /* Number of buffers in List */ 27 uint16_t first_scprfx_length; /* Length of first sc prefix in this list */ 28 int32_t start_offset; /* starting offset of unused data including sc prefix in first buffer */ 29 int32_t end_offset; /* Offset of unsused data in last buffer including 2nd sc prefix */ 30 viddec_input_buffer_t sc_ibuf[MAX_IBUFS_PER_SC]; /* Place to store buffer descriptors */ 31 viddec_pm_utils_au_bytepos_t data[MAX_IBUFS_PER_SC]; /* place to store au byte positions */ 32 int32_t total_bytes; /* total bytes for current access unit including first sc prefix*/ 33 }viddec_pm_utils_list_t; 34 35 /* This function initialises the list to default values */ 36 void viddec_pm_utils_list_init(viddec_pm_utils_list_t *cxt); 37 38 /* This function adds a new entry to list and will emit tags if needed */ 39 uint32_t viddec_pm_utils_list_addbuf(viddec_pm_utils_list_t *list, viddec_input_buffer_t *es_buf); 40 41 /* This function updates au byte position of the current list. This should be called after sc codes are detected and before 42 syntax parsing as get bits requires this to be initialized. */ 43 void viddec_pm_utils_list_updatebytepos(viddec_pm_utils_list_t *list, uint8_t sc_prefix_length); 44 45 /* This function walks through the list and removes consumed buffers based on total bytes. It then moves 46 unused entires to the top of list. */ 47 void viddec_pm_utils_list_remove_used_entries(viddec_pm_utils_list_t *list, uint32_t length); 48 49 /* this function returns 1 if the requested byte is not found. If found returns list and offset into list */ 50 uint32_t viddec_pm_utils_list_getbyte_position(viddec_pm_utils_list_t *list, uint32_t byte, uint32_t *list_index, uint32_t *offset); 51 #endif 52