Home | History | Annotate | Download | only in include
      1 #ifndef VIDDEC_PARSER_OPS_H
      2 #define VIDDEC_PARSER_OPS_H
      3 
      4 #include "viddec_fw_workload.h"
      5 
      6 #define VIDDEC_PARSE_INVALID_POS 0xFFFFFFFF
      7 
      8 typedef enum
      9 {
     10     VIDDEC_PARSE_EOS = 0x0FFF, /* Dummy start code to force EOS */
     11     VIDDEC_PARSE_DISCONTINUITY,  /* Dummy start code to force completion and flush */
     12 }viddec_parser_inband_messages_t;
     13 
     14 typedef struct
     15 {
     16     uint32_t context_size;
     17     uint32_t persist_size;
     18 }viddec_parser_memory_sizes_t;
     19 
     20 typedef struct
     21 {
     22     void  (*init)(void *ctxt, uint32_t *persist, uint32_t preserve);
     23     uint32_t (*parse_sc) (void *ctxt, void *pcxt, void *sc_state);
     24     uint32_t (*parse_syntax) (void *parent, void *ctxt);
     25     void (*get_cxt_size) (viddec_parser_memory_sizes_t *size);
     26     uint32_t (*is_wkld_done)(void *parent, void *ctxt, uint32_t next_sc, uint32_t *codec_specific_errors);
     27     uint32_t (*is_frame_start)(void *ctxt);
     28     uint32_t (*gen_contrib_tags)(void *parent, uint32_t ignore_partial);
     29     uint32_t (*gen_assoc_tags)(void *parent);
     30 }viddec_parser_ops_t;
     31 
     32 
     33 typedef enum
     34 {
     35     VIDDEC_PARSE_ERROR = 0xF0,
     36     VIDDEC_PARSE_SUCESS = 0xF1,
     37     VIDDEC_PARSE_FRMDONE = 0xF2,
     38 }viddec_parser_error_t;
     39 
     40 /*
     41  *
     42  *Functions used by Parsers
     43  *
     44  */
     45 
     46 /* This function returns the requested number of bits(<=32) and increments au byte position.
     47  */
     48 int32_t viddec_pm_get_bits(void *parent, uint32_t *data, uint32_t num_bits);
     49 
     50 /* This function returns requested number of bits(<=32) with out incrementing au byte position
     51  */
     52 int32_t viddec_pm_peek_bits(void *parent, uint32_t *data, uint32_t num_bits);
     53 
     54 /* This function skips requested number of bits(<=32) by incrementing au byte position.
     55  */
     56 int32_t viddec_pm_skip_bits(void *parent, uint32_t num_bits);
     57 
     58 /* This function appends a work item to current workload.
     59  */
     60 int32_t viddec_pm_append_workitem(void *parent, viddec_workload_item_t *item);
     61 
     62 /* This function appends a work item to next workload.
     63  */
     64 int32_t viddec_pm_append_workitem_next(void *parent, viddec_workload_item_t *item);
     65 
     66 /* This function gets current byte and bit positions and information on whether an emulation byte is present after
     67 current byte.
     68  */
     69 int32_t viddec_pm_get_au_pos(void *parent, uint32_t *bit, uint32_t *byte, unsigned char *is_emul);
     70 
     71 /* This function appends Pixel tag to current work load starting from current position to end of au unit.
     72  */
     73 int32_t viddec_pm_append_pixeldata(void *parent);
     74 
     75 /* This function appends Pixel tag to next work load starting from current position to end of au unit.
     76  */
     77 int32_t viddec_pm_append_pixeldata_next(void *parent);
     78 
     79 /* This function provides the workload header for pasers to fill in attribute values
     80  */
     81 viddec_workload_t* viddec_pm_get_header(void *parent);
     82 
     83 /* This function provides the next workload header for pasers to fill in attribute values
     84  */
     85 viddec_workload_t* viddec_pm_get_next_header(void *parent);
     86 
     87 /* Returns the current byte value where offset is on */
     88 uint32_t viddec_pm_get_cur_byte(void *parent, uint8_t *byte);
     89 
     90 /* Tells us if there is more data that need to parse */
     91 int32_t viddec_pm_is_nomoredata(void *parent);
     92 
     93 /* This function appends misc tag to work load starting from start position to end position of au unit */
     94 int32_t viddec_pm_append_misc_tags(void *parent, uint32_t start, uint32_t end, viddec_workload_item_t *wi, uint32_t using_next);
     95 
     96 void viddec_pm_set_next_frame_error_on_eos(void *parent, uint32_t error);
     97 
     98 void viddec_pm_set_late_frame_detect(void *parent);
     99 
    100 static inline void viddec_fw_reset_workload_item(viddec_workload_item_t *wi)
    101 {
    102     wi->vwi_payload[0] = wi->vwi_payload[1] = wi->vwi_payload[2] = 0;
    103 }
    104 
    105 void viddec_pm_setup_userdata(viddec_workload_item_t *wi);
    106 #endif
    107