RetCode decoder_init() { // Set default values of gdd and pdd when necessary memset(&pdd, 0, sizeof(pdd)); // memset(&gdd, 0, sizeof(gdd)); static slice_header_t dummy_sh; // a all 0-filled structure that will prevent from testing if prev_sh pointer is non null each time it is accessed ! pdd.max_num_of_slices = 1; pdd.decoding_finished = 0; memset(&dummy_sh, 0, sizeof(dummy_sh)); // all 0 should make a good "before-first" slice pdd.prev_sh = &dummy_sh; // needed so that there is no need to test if the pointer is non null // Init CABAC tables cabac_init_data(); init_dpb(); return RET_SUCCESS; }
/*! ************************************************************************ * \brief * Interpret the Buffering period SEI message * \param payload * a pointer that point to the sei payload * \param size * the size of the sei message * \param img * the image pointer * ************************************************************************ */ void interpret_buffering_period_info( byte* payload, int size, ImageParameters *img ) { int seq_parameter_set_id, initial_cpb_removal_delay, initial_cpb_removal_delay_offset; unsigned int k; Bitstream* buf; seq_parameter_set_rbsp_t *sps; #ifdef ESLCPP buf = (Bitstream*)malloc(sizeof(Bitstream)); #else buf = malloc(sizeof(Bitstream)); #endif buf->bitstream_length = size; buf->streamBuffer = payload; buf->frame_bitoffset = 0; UsedBits = 0; seq_parameter_set_id = ue_v("SEI: seq_parameter_set_id" , buf); sps = &SeqParSet[seq_parameter_set_id]; if (active_sps != sps) { active_sps = sps; init_dpb(); } #ifdef PRINT_BUFFERING_PERIOD_INFO printf("Buffering period SEI message\n"); printf("seq_parameter_set_id = %d\n", seq_parameter_set_id); #endif if (sps->vui_seq_parameters.nal_hrd_parameters_present_flag) { for (k=0; k<sps->vui_seq_parameters.nal_hrd_parameters.cpb_cnt; k++) { initial_cpb_removal_delay = u_v(sps->vui_seq_parameters.nal_hrd_parameters.cpb_removal_delay_length_minus1+1, "SEI: initial_cpb_removal_delay" , buf); initial_cpb_removal_delay_offset = u_v(sps->vui_seq_parameters.nal_hrd_parameters.cpb_removal_delay_length_minus1+1, "SEI: initial_cpb_removal_delay_offset" , buf); #ifdef PRINT_BUFFERING_PERIOD_INFO printf("nal initial_cpb_removal_delay[%d] = %d\n", k, initial_cpb_removal_delay); printf("nal initial_cpb_removal_delay_offset[%d] = %d\n", k, initial_cpb_removal_delay_offset); #endif } } if (sps->vui_seq_parameters.vcl_hrd_parameters_present_flag) { for (k=0; k<sps->vui_seq_parameters.vcl_hrd_parameters.cpb_cnt; k++) { initial_cpb_removal_delay = u_v(sps->vui_seq_parameters.vcl_hrd_parameters.cpb_removal_delay_length_minus1+1, "SEI: initial_cpb_removal_delay" , buf); initial_cpb_removal_delay_offset = u_v(sps->vui_seq_parameters.vcl_hrd_parameters.cpb_removal_delay_length_minus1+1, "SEI: initial_cpb_removal_delay_offset" , buf); #ifdef PRINT_BUFFERING_PERIOD_INFO printf("vcl initial_cpb_removal_delay[%d] = %d\n", k, initial_cpb_removal_delay); printf("vcl initial_cpb_removal_delay_offset[%d] = %d\n", k, initial_cpb_removal_delay_offset); #endif } } free (buf); #ifdef PRINT_BUFFERING_PERIOD_INFO #undef PRINT_BUFFERING_PERIOD_INFO #endif }