static void init_vbi_decoder (void) { vbi_event_mask event_mask; vbi_bool success; /* XXX videostd? */ vbi = vbi_decoder_new (/* cache: allocate one */ NULL, /* network: current */ NULL, VBI_VIDEOSTD_SET_625_50); if (NULL == vbi) no_mem_exit (); vbi_decoder_detect_channel_change (vbi, option_dcc); event_mask = (VBI_EVENT_TTX_PAGE | VBI_EVENT_CC_PAGE); if (option_fast) event_mask |= VBI_EVENT_PAGE_TYPE; success = vbi_decoder_add_event_handler (vbi, event_mask, event_handler, /* user_data */ NULL); if (!success) no_mem_exit (); }
/*! *********************************************************************** * \brief * Allocate the Video Parameters structure * \par Output: * Video Parameters VideoParameters *p_Vid *********************************************************************** */ static void alloc_video_params( VideoParameters **p_Vid) { int i; if ((*p_Vid = (VideoParameters *) calloc(1, sizeof(VideoParameters)))==NULL) no_mem_exit("alloc_video_params: p_Vid"); if (((*p_Vid)->old_slice = (OldSliceParams *) calloc(1, sizeof(OldSliceParams)))==NULL) no_mem_exit("alloc_video_params: p_Vid->old_slice"); if (((*p_Vid)->snr = (SNRParameters *)calloc(1, sizeof(SNRParameters)))==NULL) no_mem_exit("alloc_video_params: p_Vid->snr"); // Allocate new dpb buffer for (i = 0; i < MAX_NUM_DPB_LAYERS; i++) { if(((*p_Vid)->p_EncodePar[i] = (CodingParameters *)calloc(1, sizeof(CodingParameters))) == NULL) no_mem_exit("alloc_video_params:p_Vid->p_EncodePar[i]"); ((*p_Vid)->p_EncodePar[i])->layer_id = i; } (*p_Vid)->global_init_done[0] = (*p_Vid)->global_init_done[1] = 0; if(((*p_Vid)->ppSliceList = (Slice **) calloc(MAX_NUM_DECSLICES, sizeof(Slice *))) == NULL) { no_mem_exit("alloc_video_params: p_Vid->ppSliceList"); } (*p_Vid)->iNumOfSlicesAllocated = MAX_NUM_DECSLICES; (*p_Vid)->pNextSlice = NULL; (*p_Vid)->nalu = AllocNALU(MAX_CODED_FRAME_SIZE); (*p_Vid)->pNextPPS = AllocPPS(); (*p_Vid)->first_sps = TRUE; }
/*! ******************************************************************************* * \brief * Dynamic memory allocation of all infomation needed for backward prediction * \par Input: * \return Number of allocated bytes * \Date: 2003/3 ******************************************************************************* */ int get_mem_bwmincost (int****** mv) { int i, j, k, l; if ((*mv = (int*****)calloc(input->img_width/4,sizeof(int****))) == NULL) no_mem_exit ("get_mem_mv: mv"); for (i=0; i<input->img_width/4; i++) { if (((*mv)[i] = (int****)calloc(input->img_height/4,sizeof(int***))) == NULL) no_mem_exit ("get_mem_mv: mv"); for (j=0; j<input->img_height/4; j++) { if (((*mv)[i][j] = (int***)calloc(img->max_num_references,sizeof(int**))) == NULL) no_mem_exit ("get_mem_mv: mv"); for (k=0; k<img->max_num_references; k++) { if (((*mv)[i][j][k] = (int**)calloc(9,sizeof(int*))) == NULL) no_mem_exit ("get_mem_mv: mv"); for (l=0; l<9; l++) if (((*mv)[i][j][k][l] = (int*)calloc(3,sizeof(int))) == NULL) no_mem_exit ("get_mem_mv: mv"); } } } return input->img_width/4*input->img_height/4*img->max_num_references*9*3*sizeof(int); }
void initBitsFile (VideoParameters *p_Vid, int filemode) { switch (filemode) { case PAR_OF_ANNEXB: if ((p_Vid->bitsfile = (BitsFile *) calloc(1, sizeof(BitsFile)))==NULL) no_mem_exit("initBitsFile : p_Vid->bitsfile"); p_Vid->bitsfile->OpenBitsFile = OpenAnnexBFile; p_Vid->bitsfile->CloseBitsFile = CloseAnnexBFile; p_Vid->bitsfile->GetNALU = GetAnnexbNALU; malloc_annex_b(p_Vid); break; case PAR_OF_RTP: if ((p_Vid->bitsfile = (BitsFile *) calloc(1, sizeof(BitsFile)))==NULL) no_mem_exit("initBitsFile : p_Vid->bitsfile"); p_Vid->bitsfile->OpenBitsFile = OpenRTPFile; p_Vid->bitsfile->CloseBitsFile = CloseRTPFile; p_Vid->bitsfile->GetNALU = GetRTPNALU; break; default: error ("initBitsFile: Unknown bitstream file mode", 255); break; } }
/*! *********************************************************************** * \brief * allocates and initializes decoder statistics memory * \param stats * Decoder statistics * \return *********************************************************************** */ void init_dec_stats(DecStatParameters *stats) { int i, j; int64 *hist; for (i = 0; i < NUM_SLICE_TYPES; i++) { stats->frame_ctr[i] = 0; for (j = 0; j < MAXMODE; j++) { stats->mode_use [i][j] = 0; stats->mode_use_transform[i][j][0] = 0; stats->mode_use_transform[i][j][1] = 0; } } for (i = 0; i < 2; i++) { for (j = 0; j < 2; j++) { if ((hist = (int64 *) malloc (4096 * sizeof (int64)))== NULL) no_mem_exit ("init_dec_stats: stats->histogram_mv"); memset(hist, 0, 4096 * sizeof (int64)); stats->histogram_mv[i][j] = hist + 2048; } if ((hist = (int64 *) malloc (17 * sizeof (int64)))== NULL) no_mem_exit ("init_dec_stats: stats->histogram_refs"); memset(hist, 0, 17 * sizeof (int64)); stats->histogram_refs[i] = hist + 1; } }
int GetRTPNALU (NALU_t *nalu) { RTPpacket_t *p; int ret; if ((p=malloc (sizeof (RTPpacket_t)))== NULL) no_mem_exit ("GetRTPNALU-1"); if ((p->packet=malloc (MAXRTPPACKETSIZE))== NULL) no_mem_exit ("GetRTPNALU-2"); if ((p->payload=malloc (MAXRTPPACKETSIZE))== NULL) no_mem_exit ("GetRTPNALU-3"); ret = RTPReadPacket (p, bits); nalu->forbidden_bit = 1; nalu->len = 0; if (ret < 0) return -1; if (ret == 0) return 0; assert (p->paylen < nalu->max_size); nalu->len = p->paylen; memcpy (nalu->buf, p->payload, p->paylen); nalu->forbidden_bit = (nalu->buf[0]>>7) & 1; nalu->nal_reference_idc = (nalu->buf[0]>>5) & 3; nalu->nal_unit_type = (nalu->buf[0]) & 0x1f; free (p->payload); free (p->packet); free (p); // printf ("Got an RTP NALU, len %d, first byte %x\n", nalu->len, nalu->buf[0]); return nalu->len; }
void poc_based_ref_management(int current_pic_num) { unsigned i, pic_num = 0; int min_poc=INT_MAX; DecRefPicMarking_t *tmp_drpm,*tmp_drpm2; if (img->dec_ref_pic_marking_buffer!=NULL) return; if ((dpb.ref_frames_in_buffer+dpb.ltref_frames_in_buffer)==0) return; for (i=0; i<dpb.used_size;i++) { if (dpb.fs[i]->is_reference && (!(dpb.fs[i]->is_long_term)) && dpb.fs[i]->poc < min_poc) { min_poc = dpb.fs[i]->frame->poc ; pic_num = dpb.fs[i]->frame->pic_num; } } if (NULL==(tmp_drpm=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm"); tmp_drpm->Next=NULL; tmp_drpm->memory_management_control_operation = 0; if (NULL==(tmp_drpm2=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm2"); tmp_drpm2->Next=tmp_drpm; tmp_drpm2->memory_management_control_operation = 1; tmp_drpm2->difference_of_pic_nums_minus1 = current_pic_num - pic_num - 1; img->dec_ref_pic_marking_buffer = tmp_drpm2; }
void mmco_long_term(VideoParameters *p_Vid, int current_pic_num) { DecRefPicMarking_t *tmp_drpm,*tmp_drpm2; if ( !p_Vid->currentPicture->idr_flag ) { if (p_Vid->dec_ref_pic_marking_buffer!=NULL) return; if (NULL==(tmp_drpm=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm"); tmp_drpm->Next=NULL; tmp_drpm->memory_management_control_operation = 0; if (NULL==(tmp_drpm2=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm2"); tmp_drpm2->Next=tmp_drpm; tmp_drpm2->memory_management_control_operation = 3; tmp_drpm2->long_term_frame_idx = current_pic_num; p_Vid->dec_ref_pic_marking_buffer = tmp_drpm2; } else { p_Vid->long_term_reference_flag = TRUE; } }
static void parse_output_option (void) { assert (NULL != optarg); free (out_file_name_prefix); out_file_name_prefix = NULL; free (out_file_name_suffix); out_file_name_suffix = NULL; if (0 == strcmp (optarg, "-")) { /* Write to stdout. */ } else { char *s; s = strrchr (optarg, '.'); if (NULL == s) { out_file_name_prefix = strdup (optarg); if (NULL == out_file_name_prefix) no_mem_exit (); } else { out_file_name_prefix = strndup (optarg, s - optarg); if (NULL == out_file_name_prefix) no_mem_exit (); if (0 != s[1]) { out_file_name_suffix = strdup (s + 1); if (NULL == out_file_name_suffix) no_mem_exit (); } } } }
int WriteRTPNALU (VideoParameters *p_Vid, NALU_t *n, FILE **f_rtp) { RTPpacket_t *p; byte first_byte; assert ((*f_rtp) != NULL); assert (n != NULL); assert (n->len < 65000); first_byte = (byte) (n->forbidden_bit << 7 | n->nal_reference_idc << 5 | n->nal_unit_type ); // Set RTP structure elements and alloca() memory foor the buffers if ((p = (RTPpacket_t *) malloc (sizeof (RTPpacket_t))) == NULL) no_mem_exit ("RTPWriteNALU-1"); if ((p->packet = malloc (MAXRTPPACKETSIZE)) == NULL) no_mem_exit ("RTPWriteNALU-2"); if ((p->payload = malloc (MAXRTPPACKETSIZE)) == NULL) no_mem_exit ("RTPWriteNALU-3"); p->v=2; p->p=0; p->x=0; p->cc=0; p->m=(n->startcodeprefix_len==4)&1; // a long startcode of Annex B sets marker bit of RTP // Not exactly according to the RTP paylaod spec, but // good enough for now (hopefully). //! For error resilience work, we need the correct //! marker bit. Introduce a nalu->marker and set it in //! terminate_slice()? p->pt=H264PAYLOADTYPE; p->seq = p_Vid->CurrentRTPSequenceNumber++; p->timestamp = p_Vid->CurrentRTPTimestamp; p->ssrc=H264SSRC; p->paylen = 1 + n->len; p->payload[0] = first_byte; memcpy (p->payload+1, n->buf, n->len); // Generate complete RTP packet if (ComposeRTPPacket (p) < 0) { printf ("Cannot compose RTP packet, exit\n"); exit (-1); } if (WriteRTPPacket (p, *f_rtp) < 0) { printf ("Cannot write %d bytes of RTP packet to outfile, exit\n", p->packlen); exit (-1); } free (p->packet); free (p->payload); free (p); return (n->len * 8); }
void cra_ref_management_frame_pic(DecodedPictureBuffer *p_Dpb, int current_pic_num) { VideoParameters *p_Vid = p_Dpb->p_Vid; unsigned i; int pic_num = 0; //int min_poc=INT_MAX; DecRefPicMarking_t *tmp_drpm,*tmp_drpm2; int last_intra_poc = p_Vid->currentSlice->ThisPOC / 2 / p_Vid->p_Inp->intra_period * p_Vid->p_Inp->intra_period * 2; if (p_Vid->dec_ref_pic_marking_buffer!=NULL) return; if ( p_Vid->currentPicture->idr_flag ) return; if ((p_Dpb->ref_frames_in_buffer + p_Dpb->ltref_frames_in_buffer)==0) return; if (NULL==(tmp_drpm=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm"); tmp_drpm->Next=NULL; tmp_drpm->memory_management_control_operation = 0; for (i = 0; i < p_Dpb->used_size; i++) { if (p_Dpb->fs[i]->is_reference && (!(p_Dpb->fs[i]->is_long_term)) && p_Dpb->fs[i]->poc < last_intra_poc) { if (NULL==(tmp_drpm2=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm2"); tmp_drpm2->Next=tmp_drpm; tmp_drpm2->memory_management_control_operation = 1; pic_num = p_Dpb->fs[i]->frame->pic_num; if ( p_Vid->num_of_layers == 1 ) tmp_drpm2->difference_of_pic_nums_minus1 = current_pic_num - pic_num - 1; else tmp_drpm2->difference_of_pic_nums_minus1 = (current_pic_num - pic_num)/2 - 1; if ( tmp_drpm2->difference_of_pic_nums_minus1 < 0 ) { tmp_drpm2->difference_of_pic_nums_minus1 += p_Vid->currentSlice->max_frame_num; } if ( tmp_drpm2->difference_of_pic_nums_minus1 >= (int) p_Vid->currentSlice->max_frame_num ) { tmp_drpm2->difference_of_pic_nums_minus1 -= p_Vid->currentSlice->max_frame_num; } tmp_drpm = tmp_drpm2; } } p_Vid->dec_ref_pic_marking_buffer = tmp_drpm; }
pic_parameter_set_rbsp_t *AllocPPS () { pic_parameter_set_rbsp_t *p; if ((p=calloc (sizeof (pic_parameter_set_rbsp_t), 1)) == NULL) no_mem_exit ("AllocPPS: PPS"); if ((p->slice_group_id = calloc (SIZEslice_group_id, 1)) == NULL) //++ SIZEslice_group_id=sizeof(int) * 60000 no_mem_exit ("AllocPPS: slice_group_id"); return p; }
pic_parameter_set_rbsp_t *AllocPPS () { pic_parameter_set_rbsp_t *p; if ((p=(pic_parameter_set_rbsp_t *) _aligned_malloc (sizeof (pic_parameter_set_rbsp_t), 16)) == NULL) no_mem_exit ("AllocPPS: PPS"); if ((p->slice_group_id = (unsigned int *) _aligned_malloc (SIZEslice_group_id, 16)) == NULL) no_mem_exit ("AllocPPS: slice_group_id"); return p; }
/* ************************************************************************* * Function: allocates the memory for the coded picture data * Input: * Output: * Return: * Attention: ************************************************************************* */ void c_avs_enc:: AllocateBitstream() { const int_32_t buffer_size = (bytes_y << 2); if ((currBitStream = (Bitstream *) calloc(1, sizeof(Bitstream))) == NULL) no_mem_exit ("malloc_slice: Bitstream"); if ((currBitStream->streamBuffer = (byte *) calloc(buffer_size, sizeof(byte))) == NULL) no_mem_exit ("malloc_slice: StreamBuffer"); currBitStream->bits_to_go = 8; }
void poc_based_ref_management_field_pic(DecodedPictureBuffer *p_Dpb, int current_pic_num) { VideoParameters *p_Vid = p_Dpb->p_Vid; unsigned int i; int pic_num1 = 0, pic_num2 = 0; int min_poc=INT_MAX; DecRefPicMarking_t *tmp_drpm,*tmp_drpm2, *tmp_drpm3; if (p_Vid->dec_ref_pic_marking_buffer!=NULL) return; if ( p_Vid->currentPicture->idr_flag ) return; if ((p_Dpb->ref_frames_in_buffer + p_Dpb->ltref_frames_in_buffer)==0) return; if ( p_Vid->structure == TOP_FIELD ) { for (i=0; i<p_Dpb->used_size;i++) { if (p_Dpb->fs[i]->is_reference && (!(p_Dpb->fs[i]->is_long_term)) && p_Dpb->fs[i]->poc < min_poc) { min_poc = p_Dpb->fs[i]->poc; pic_num1 = p_Dpb->fs[i]->top_field->pic_num; pic_num2 = p_Dpb->fs[i]->bottom_field->pic_num; } } } if (NULL==(tmp_drpm=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management_field_pic: tmp_drpm"); tmp_drpm->Next=NULL; tmp_drpm->memory_management_control_operation = 0; if ( p_Vid->structure == BOTTOM_FIELD ) { p_Vid->dec_ref_pic_marking_buffer = tmp_drpm; return; } if (NULL==(tmp_drpm2=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management_field_pic: tmp_drpm2"); tmp_drpm2->Next=tmp_drpm; tmp_drpm2->memory_management_control_operation = 1; tmp_drpm2->difference_of_pic_nums_minus1 = current_pic_num - pic_num1 - 1; if (NULL==(tmp_drpm3=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management_field_pic: tmp_drpm3"); tmp_drpm3->Next=tmp_drpm2; tmp_drpm3->memory_management_control_operation = 1; tmp_drpm3->difference_of_pic_nums_minus1 = current_pic_num - pic_num2 - 1; p_Vid->dec_ref_pic_marking_buffer = tmp_drpm3; }
NALU_t *AllocNALU(int buffersize) { NALU_t *n; if ((n = (NALU_t*)calloc (1, sizeof (NALU_t))) == NULL) no_mem_exit ("AllocNALU: n"); n->max_size=buffersize; if ((n->buf = (byte*)calloc (buffersize, sizeof (byte))) == NULL) no_mem_exit ("AllocNALU: n->buf"); return n; }
/*! ************************************************************************************* * \brief * Dynamically allocate memory needed for generic rate control * ************************************************************************************* */ void rc_alloc_generic( VideoParameters *p_Vid, RCGeneric **p_quad ) { *p_quad = (RCGeneric *) malloc ( sizeof( RCGeneric ) ); if (NULL == *p_quad) { no_mem_exit("rc_alloc_generic: rc_alloc_generic"); } (*p_quad)->MADofMB = (int *) calloc (p_Vid->FrameSizeInMbs, sizeof (int)); if (NULL == (*p_quad)->MADofMB) { no_mem_exit("rc_alloc_generic: (*p_quad)->MADofMB"); } (*p_quad)->FieldFrame = 1; }
void tlyr_based_ref_management_frame_pic(VideoParameters *p_Vid, int current_pic_num) { unsigned i, first = 1; DecRefPicMarking_t *drpm = NULL, *current_drpm = NULL, *tmp_drpm = NULL; struct decoded_picture_buffer *p_Dpb = p_Vid->p_Dpb_layer[0]; if (p_Vid->dec_ref_pic_marking_buffer!=NULL) return; if ( p_Vid->currentPicture->idr_flag ) return; if ((p_Dpb->ref_frames_in_buffer + p_Dpb->ltref_frames_in_buffer)==0) return; for (i = 0; i < p_Dpb->used_size; i++) { if (p_Dpb->fs[i]->is_reference && (!(p_Dpb->fs[i]->is_long_term)) && p_Dpb->fs[i]->frame->temporal_layer > p_Vid->enc_picture->temporal_layer) { if (NULL == (tmp_drpm=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm2"); tmp_drpm->memory_management_control_operation = 1; tmp_drpm->difference_of_pic_nums_minus1 = current_pic_num - p_Dpb->fs[i]->frame->pic_num - 1; if (first) { drpm = current_drpm = tmp_drpm; first = 0; } else { current_drpm->Next = tmp_drpm; current_drpm = current_drpm->Next; } } } if (first) return; if (NULL==(tmp_drpm=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm"); tmp_drpm->Next=NULL; tmp_drpm->memory_management_control_operation = 0; current_drpm->Next=tmp_drpm; p_Vid->dec_ref_pic_marking_buffer = drpm; }
// same change as in get_mem2Dint int get_mem2Dint(int ***array2D, int rows, int columns) { int i; if((*array2D = (int**)calloc(rows, sizeof(int*))) == NULL) no_mem_exit("get_mem2Dint: array2D"); if(((*array2D)[0] = (int* )calloc(rows*columns,sizeof(int ))) == NULL) no_mem_exit("get_mem2Dint: array2D"); for(i=1 ; i<rows ; i++) (*array2D)[i] = (*array2D)[i-1] + columns ; return rows*columns*sizeof(int); }
// Change 9-Aug-2001 P. List: dont allocate independant row arrays anymore // but one complete array and move row-pointers to array. Now you can step // to the next line with an offset of img->width int get_mem2D(byte ***array2D, int rows, int columns) { int i; if((*array2D = (byte**)calloc(rows, sizeof(byte*))) == NULL) no_mem_exit("get_mem2D: array2D"); if(((*array2D)[0] = (byte* )calloc(columns*rows,sizeof(byte ))) == NULL) no_mem_exit("get_mem2D: array2D"); for(i=1;i<rows;i++) (*array2D)[i] = (*array2D)[i-1] + columns ; return rows*columns; }
void poc_based_ref_management_field_pic(int current_pic_num) { unsigned int i, pic_num1 = 0, pic_num2 = 0; int min_poc=INT_MAX; DecRefPicMarking_t *tmp_drpm,*tmp_drpm2, *tmp_drpm3; if (img->dec_ref_pic_marking_buffer!=NULL) return; if ((dpb.ref_frames_in_buffer+dpb.ltref_frames_in_buffer)==0) return; if ( img->structure == TOP_FIELD ) { for (i=0; i<dpb.used_size;i++) { if (dpb.fs[i]->is_reference && (!(dpb.fs[i]->is_long_term)) && dpb.fs[i]->poc < min_poc) { min_poc = dpb.fs[i]->poc; pic_num1 = dpb.fs[i]->top_field->pic_num; pic_num2 = dpb.fs[i]->bottom_field->pic_num; } } } if (NULL==(tmp_drpm=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management_field_pic: tmp_drpm"); tmp_drpm->Next=NULL; tmp_drpm->memory_management_control_operation = 0; if ( img->structure == BOTTOM_FIELD ) { img->dec_ref_pic_marking_buffer = tmp_drpm; return; } if (NULL==(tmp_drpm2=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management_field_pic: tmp_drpm2"); tmp_drpm2->Next=tmp_drpm; tmp_drpm2->memory_management_control_operation = 1; tmp_drpm2->difference_of_pic_nums_minus1 = current_pic_num - pic_num1 - 1; if (NULL==(tmp_drpm3=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management_field_pic: tmp_drpm3"); tmp_drpm3->Next=tmp_drpm2; tmp_drpm3->memory_management_control_operation = 1; tmp_drpm3->difference_of_pic_nums_minus1 = current_pic_num - pic_num2 - 1; img->dec_ref_pic_marking_buffer = tmp_drpm3; }
void wpxInitWPXObject( VideoParameters *p_Vid ) { p_Vid->pWPX = (WPXObject *)malloc( sizeof( WPXObject ) ); if ( p_Vid->pWPX == NULL ) { fprintf( stderr, "\n Error initializing memory for WPXObject. Exiting...\n" ); exit(1); } // wp_ref_l0 if ((p_Vid->pWPX->wp_ref_list[LIST_0] = (WeightedPredRefX *) calloc(MAX_REFERENCE_PICTURES, sizeof(WeightedPredRefX))) == NULL) no_mem_exit("wpxInitWPXObject: p_Vid->pWPX->wp_ref_list[0]"); // wp_ref_l1 if ((p_Vid->pWPX->wp_ref_list[LIST_1] = (WeightedPredRefX *) calloc(MAX_REFERENCE_PICTURES, sizeof(WeightedPredRefX))) == NULL) no_mem_exit("wpxInitWPXObject: p_Vid->pWPX->wp_ref_list[1]"); }
void InitSEIMessages() { int i; for (i=0; i<2; i++) { sei_message[i].data = malloc(MAXRTPPAYLOADLEN); if( sei_message[i].data == NULL ) no_mem_exit("InitSEIMessages: sei_message[i].data"); sei_message[i].subPacketType = SEI_PACKET_TYPE; clear_sei_message(i); } // init sei messages seiSparePicturePayload.data = NULL; InitSparePicture(); InitSubseqChar(); if (input->NumFramesInELSubSeq != 0) InitSubseqLayerInfo(); InitSceneInformation(); // JVT-D099 // init panscanrect sei message InitPanScanRectInfo(); // init user_data_unregistered InitUser_data_unregistered(); // init user_data_unregistered InitUser_data_registered_itu_t_t35(); // init user_RandomAccess InitRandomAccess(); }
static void init_export_module (const char * module_name) { const vbi_export_info *xi; char *errstr; errstr = NULL; /* just in case */ ex = vbi_export_new (module_name, &errstr); if (NULL == ex) { error_exit (_("Cannot open export module '%s': %s"), module_name, errstr); /* NB. free (errstr); here if you don't exit(). */ } if (0 == strncmp (module_name, "html", 4)) { if (option_hyperlinks) vbi_export_set_link_cb (ex, export_link, /* user_data */ NULL); if (option_pdc_links) vbi_export_set_pdc_cb (ex, export_pdc, /* user_data */ NULL); } xi = vbi_export_info_from_export (ex); if (NULL == xi) no_mem_exit (); if (NULL == out_file_name_suffix) { char *end = NULL; out_file_name_suffix = strdup (xi->extension); if (NULL == out_file_name_suffix) no_mem_exit (); out_file_name_suffix = strtok_r (out_file_name_suffix, ",", &end); } #if 3 == VBI_VERSION_MINOR if (xi->open_format) option_subtitles ^= TRUE; #endif }
/*! ************************************************************************ * \brief * Initialization of GOP structure. * ************************************************************************ */ void init_gop_structure() { int max_gopsize = input->HierarchicalCoding != 3 ? input->successive_Bframe : input->jumpd; gop_structure = calloc(imax(10,max_gopsize), sizeof (GOP_DATA)); // +1 for reordering if (NULL==gop_structure) no_mem_exit("init_gop_structure: gop_structure"); }
seq_parameter_set_rbsp_t *AllocSPS () { seq_parameter_set_rbsp_t *p; if ((p=calloc (sizeof (seq_parameter_set_rbsp_t), 1)) == NULL) no_mem_exit ("AllocSPS: SPS"); return p; }
/*! ************************************************************************ * \brief * Initialize output buffer for direct output ************************************************************************ */ void init_out_buffer() { out_buffer = alloc_frame_store(); pending_output = calloc (sizeof(StorablePicture), 1); if (NULL==pending_output) no_mem_exit("init_out_buffer"); pending_output->imgUV = NULL; pending_output->imgY = NULL; }
/*! ************************************************************************ * \brief * Initialization of GOP structure. * ************************************************************************ */ void init_gop_structure(VideoParameters *p_Vid, InputParameters *p_Inp) { int max_gopsize = p_Inp->NumberBFrames; p_Vid->gop_structure = calloc(imax(10,max_gopsize), sizeof (GOP_DATA)); // +1 for reordering if (NULL==p_Vid->gop_structure) no_mem_exit("init_gop_structure: gop_structure"); }
/*! ************************************************************************ * \brief * Allocates memory for the DecodingEnvironment struct * \return DecodingContextPtr * allocates memory ************************************************************************ */ DecodingEnvironmentPtr arideco_create_decoding_environment() { DecodingEnvironmentPtr dep; if ((dep = calloc(1,sizeof(DecodingEnvironment))) == NULL) no_mem_exit("arideco_create_decoding_environment: dep"); return dep; }
void poc_based_ref_management_frame_pic(DecodedPictureBuffer *p_Dpb, int current_pic_num) { VideoParameters *p_Vid = p_Dpb->p_Vid; unsigned i, pic_num = 0; int min_poc=INT_MAX; DecRefPicMarking_t *tmp_drpm,*tmp_drpm2; if (p_Vid->dec_ref_pic_marking_buffer!=NULL) return; if ( p_Vid->currentPicture->idr_flag ) return; if ((p_Dpb->ref_frames_in_buffer + p_Dpb->ltref_frames_in_buffer)==0) return; for (i = 0; i < p_Dpb->used_size; i++) { if (p_Dpb->fs[i]->is_reference && (!(p_Dpb->fs[i]->is_long_term)) && p_Dpb->fs[i]->poc < min_poc) { min_poc = p_Dpb->fs[i]->frame->poc ; pic_num = p_Dpb->fs[i]->frame->pic_num; } } if (NULL==(tmp_drpm=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm"); tmp_drpm->Next=NULL; tmp_drpm->memory_management_control_operation = 0; if (NULL==(tmp_drpm2=(DecRefPicMarking_t*)calloc (1,sizeof (DecRefPicMarking_t)))) no_mem_exit("poc_based_ref_management: tmp_drpm2"); tmp_drpm2->Next=tmp_drpm; tmp_drpm2->memory_management_control_operation = 1; #if MVC_EXTENSION_ENABLE if(p_Vid->active_sps->profile_idc < MULTIVIEW_HIGH) tmp_drpm2->difference_of_pic_nums_minus1 = current_pic_num - pic_num - 1; else tmp_drpm2->difference_of_pic_nums_minus1 = (current_pic_num - pic_num)/2 - 1; #endif p_Vid->dec_ref_pic_marking_buffer = tmp_drpm2; }