Home | History | Annotate | Download | only in include
      1 #ifndef VIDDEC_PM_H
      2 #define VIDDEC_PM_H
      3 
      4 #include <stdint.h>
      5 #include "viddec_emitter.h"
      6 #include "viddec_pm_utils_list.h"
      7 #include "viddec_pm_utils_bstream.h"
      8 #include "viddec_pm_parse.h"
      9 #include "viddec_parser_ops.h"
     10 
     11 #define SC_DETECT_BUF_SIZE 1024
     12 #define MAX_CODEC_CXT_SIZE 4096
     13 
     14 typedef enum
     15 {
     16     PM_SUCCESS = 0,
     17     /* Messages to indicate more ES data */
     18     PM_NO_DATA = 0x100,
     19     /* Messages to indicate SC found */
     20     PM_SC_FOUND = 0x200,
     21     PM_FIRST_SC_FOUND = 0x201,
     22     /* Messages to indicate Frame done */
     23     PM_WKLD_DONE = 0x300,
     24     /* Messages to indicate Error conditions */
     25     PM_OVERFLOW = 0x400,
     26     /* Messages to indicate inband conditions */
     27     PM_INBAND_MESSAGES = 0x500,
     28     PM_EOS = 0x501,
     29     PM_DISCONTINUITY = 0x502,
     30 }pm_parse_state_t;
     31 
     32 /* This is a temporary structure for first pass sc parsing. index tells us where we are in list of es buffers
     33    cur_es points to current es buffer we are parsing. */
     34 typedef struct
     35 {
     36     int32_t list_index; /* current index of list */
     37     uint32_t cur_offset;
     38     uint32_t cur_size;
     39     viddec_input_buffer_t *cur_es;
     40 }viddec_pm_sc_cur_buf_t;
     41 
     42 typedef struct
     43 {
     44     uint32_t pending_tags[MAX_IBUFS_PER_SC];
     45     uint8_t dummy;
     46     uint8_t frame_done;
     47     uint8_t first_buf_aligned;
     48     uint8_t using_next;
     49 }vidded_pm_pending_tags_t;
     50 
     51 /* This structure holds all necessary data required by parser manager for stream parsing.
     52  */
     53 typedef struct
     54 {
     55     /* Actual buffer where data gets DMA'd. 8 padding bytes for alignment */
     56     uint8_t scbuf[SC_DETECT_BUF_SIZE + 8];
     57     viddec_sc_parse_cubby_cxt_t parse_cubby;
     58     viddec_pm_utils_list_t list;
     59     /* Place to store tags to be added to next to next workload */
     60     viddec_pm_sc_cur_buf_t cur_buf;
     61     viddec_emitter emitter;
     62     viddec_pm_utils_bstream_cxt_t getbits;
     63     viddec_sc_prefix_state_t sc_prefix_info;
     64     vidded_pm_pending_tags_t pending_tags;
     65     uint8_t word_align_dummy;
     66     uint8_t late_frame_detect;
     67     uint8_t frame_start_found;
     68     uint8_t found_fm_st_in_current_au;
     69     uint32_t next_workload_error_eos;
     70     uint32_t pending_inband_tags;
     71 #ifdef VBP
     72     uint32_t codec_data[MAX_CODEC_CXT_SIZE<<3];
     73 #else
     74     uint32_t codec_data[MAX_CODEC_CXT_SIZE>>2];
     75 #endif
     76 }viddec_pm_cxt_t;
     77 
     78 /*
     79  *
     80  * Functions used by Parser kernel
     81  *
     82  */
     83 
     84 /* This is for initialising parser manager context to default values */
     85 void viddec_pm_init_context(viddec_pm_cxt_t *cxt, uint32_t codec_type, uint32_t *persist_mem, uint32_t clean);
     86 
     87 /* This is the main parse function which returns state information that parser kernel can understand.*/
     88 uint32_t viddec_pm_parse_es_buffer(viddec_pm_cxt_t *cxt, uint32_t codec_type, viddec_input_buffer_t *es_buf);
     89 
     90 void viddec_pm_init_ops();
     91 
     92 void viddec_pm_update_time(viddec_pm_cxt_t *cxt, uint32_t time);
     93 
     94 uint32_t viddec_pm_get_parser_sizes(uint32_t codec_type, viddec_parser_memory_sizes_t *size);
     95 #endif
     96