Lines Matching defs:video

22 AVCStatus InitDPB(AVCHandle *avcHandle, AVCCommonObj *video, int FrameHeightInMbs, int PicWidthInMbs, bool padding)
24 AVCDecPicBuffer *dpb = video->decPicBuf;
31 level = video->currSeqParams->level_idc;
41 video->padded_size = (int)((((FrameHeightInMbs + 2) * (PicWidthInMbs + 2)) << 7) * 3) - framesize;
45 video->padded_size = 0;
63 if (video->currSeqParams->num_ref_frames + 1 > (uint32)dpb->num_fs)
65 dpb->num_fs = video->currSeqParams->num_ref_frames + 1;
68 dpb->dpb_size = dpb->num_fs * (framesize + video->padded_size);
99 video->RefPicList0[num_fs] = &(dpb->fs[num_fs]->frame);
101 dpb->used_size += (framesize + video->padded_size);
108 OSCL_EXPORT_REF AVCStatus AVCConfigureSequence(AVCHandle *avcHandle, AVCCommonObj *video, bool padding)
111 AVCDecPicBuffer *dpb = video->decPicBuf;
116 PicWidthInMbs = video->currSeqParams->pic_width_in_mbs_minus1 + 1;
117 PicHeightInMapUnits = video->currSeqParams->pic_height_in_map_units_minus1 + 1 ;
118 FrameHeightInMbs = (2 - video->currSeqParams->frame_mbs_only_flag) * PicHeightInMapUnits ;
121 if (video->PicSizeInMapUnits != PicSizeInMapUnits || video->currSeqParams->level_idc != video->level_idc)
130 num_fs = (uint32)(MaxDPBX2[(uint32)mapLev2Idx[video->currSeqParams->level_idc]] << 2) / (3 * PicSizeInMapUnits) + 1;
146 CleanUpDPB(avcHandle, video);
147 if (InitDPB(avcHandle, video, FrameHeightInMbs, PicWidthInMbs, padding) != AVC_SUCCESS)
151 /* Allocate video->mblock upto PicSizeInMbs and populate the structure such as the neighboring MB pointers. */
153 if (video->mblock)
155 avcHandle->CBAVC_Free(userData, video->mblock);
156 video->mblock = NULL;
158 video->mblock = (AVCMacroblock*) avcHandle->CBAVC_Malloc(userData, sizeof(AVCMacroblock) * framesize, DEFAULT_ATTR);
159 if (video->mblock == NULL)
165 video->mblock[ii].slice_id = -1;
169 video->intra_pred_top = (uint8*) avcHandle->CBAVC_Malloc(userData, PicWidthInMbs << 4, FAST_MEM_ATTR);
170 if (video->intra_pred_top == NULL)
174 video->intra_pred_top_cb = (uint8*) avcHandle->CBAVC_Malloc(userData, PicWidthInMbs << 3, FAST_MEM_ATTR);
175 if (video->intra_pred_top_cb == NULL)
179 video->intra_pred_top_cr = (uint8*) avcHandle->CBAVC_Malloc(userData, PicWidthInMbs << 3, FAST_MEM_ATTR);
180 if (video->intra_pred_top_cr == NULL)
188 if (video->MbToSliceGroupMap)
190 avcHandle->CBAVC_Free(userData, video->MbToSliceGroupMap);
191 video->MbToSliceGroupMap = NULL;
193 video->MbToSliceGroupMap = (int*) avcHandle->CBAVC_Malloc(userData, sizeof(uint) * PicSizeInMapUnits * 2, 7/*DEFAULT_ATTR*/);
194 if (video->MbToSliceGroupMap == NULL)
198 video->PicSizeInMapUnits = PicSizeInMapUnits;
199 video->level_idc = video->currSeqParams->level_idc;
205 OSCL_EXPORT_REF AVCStatus CleanUpDPB(AVCHandle *avcHandle, AVCCommonObj *video)
207 AVCDecPicBuffer *dpb = video->decPicBuf;
232 OSCL_EXPORT_REF AVCStatus DPBInitBuffer(AVCHandle *avcHandle, AVCCommonObj *video)
234 AVCDecPicBuffer *dpb = video->decPicBuf;
239 /* video->currPic is assigned to this */
248 video->currFS = dpb->fs[ii];
250 status = avcHandle->CBAVC_FrameBind(avcHandle->userData, ii, &(video->currFS->base_dpb));
266 OSCL_EXPORT_REF void DPBInitPic(AVCCommonObj *video, int CurrPicNum)
273 video->currFS->PicOrderCnt = video->PicOrderCnt;
274 video->currFS->FrameNum = video->sliceHdr->frame_num;
275 video->currFS->FrameNumWrap = CurrPicNum; // MC_FIX
277 video->currFS->IsOutputted = 0;
278 video->currFS->IsReference = 0;
279 video->currFS->IsLongTerm = 0;
280 video->currFS->frame.isReference = FALSE;
281 video->currFS->frame.isLongTerm = FALSE;
284 video->currFS->frame.Sl = video->currFS->frame.Scb = video->currFS->frame.Scr = NULL;
286 /* determine video->currPic */
290 video->currPic = &(video->currFS->frame);
292 video->currPic->padded = 0; // reset this flag to not-padded
294 if (video->padded_size)
296 offset = ((video->PicWidthInSamplesL + 32) << 4) + 16; // offset to the origin
298 luma_framesize = (int)((((video->FrameHeightInMbs + 2) * (video->PicWidthInMbs + 2)) << 8));
301 luma_framesize = video->PicSizeInMbs << 8;
304 video->currPic->Sl = video->currFS->base_dpb + offset;
305 video->currPic->Scb = video->currFS->base_dpb + luma_framesize + offsetc;
306 video->currPic->Scr = video->currPic->Scb + (luma_framesize >> 2);
307 video->currPic->pitch = video->PicWidthInSamplesL + (video->padded_size == 0 ? 0 : 32);
310 video->currPic->height = video->PicHeightInSamplesL;
311 video->currPic->width = video->PicWidthInSamplesL;
312 video->currPic->PicNum = CurrPicNum;
316 OSCL_EXPORT_REF void DPBReleaseCurrentFrame(AVCHandle *avcHandle, AVCCommonObj *video)
318 AVCDecPicBuffer *dpb = video->decPicBuf;
321 video->currFS->IsOutputted = 3; // return this buffer.
329 if (dpb->fs[ii] == video->currFS)
341 OSCL_EXPORT_REF AVCStatus StorePictureInDPB(AVCHandle *avcHandle, AVCCommonObj *video)
344 AVCDecPicBuffer *dpb = video->decPicBuf;
345 AVCSliceHeader *sliceHdr = video->sliceHdr;
352 if (video->nal_unit_type == AVC_NALTYPE_IDR)
356 if (dpb->fs[ii] != video->currFS) /* not current frame */
370 video->currPic->isReference = TRUE;
371 video->currFS->IsReference = 3;
375 video->currPic->isLongTerm = FALSE;
376 video->currFS->IsLongTerm = 0;
377 video->MaxLongTermFrameIdx = -1;
381 video->currPic->isLongTerm = TRUE;
382 video->currFS->IsLongTerm = 3;
383 video->currFS->LongTermFrameIdx = 0;
384 video->MaxLongTermFrameIdx = 0;
390 if (dpb->fs[ii] != video->currFS) /* not current frame */
399 video->mem_mgr_ctrl_eq_5 = TRUE; /* flush reference frames MC_FIX */
403 if (video->currPic->isReference == TRUE)
407 status = sliding_window_process(avcHandle, video, dpb); /* we may have to do this after adaptive_memory_marking */
411 status = adaptive_memory_marking(avcHandle, video, dpb, sliceHdr);
426 if (video->nal_unit_type != AVC_NALTYPE_IDR && video->currPic->isLongTerm == FALSE)
428 if (video->currPic->isReference)
430 video->currFS->IsReference = 3;
434 video->currFS->IsReference = 0;
436 video->currFS->IsLongTerm = 0;
449 if (num_ref > (int)video->currSeqParams->num_ref_frames)
458 AVCStatus sliding_window_process(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb)
469 if (dpb->fs[ii] != video->currFS) /* do not count the current frame */
482 while (numShortTerm + numLongTerm >= (int)video->currSeqParams->num_ref_frames)
523 AVCStatus adaptive_memory_marking(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, AVCSliceHeader *sliceHdr)
533 MemMgrCtrlOp1(avcHandle, video, dpb, sliceHdr->difference_of_pic_nums_minus1[ii]);
540 MemMgrCtrlOp3(avcHandle, video, dpb, sliceHdr->difference_of_pic_nums_minus1[ii], sliceHdr->long_term_frame_idx[ii]);
543 MemMgrCtrlOp4(avcHandle, video, dpb, sliceHdr->max_long_term_frame_idx_plus1[ii]);
546 MemMgrCtrlOp5(avcHandle, video, dpb);
547 video->currFS->FrameNum = 0; //
548 video->currFS->PicOrderCnt = 0;
551 MemMgrCtrlOp6(avcHandle, video, dpb, sliceHdr->long_term_frame_idx[ii]);
567 void MemMgrCtrlOp1(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, int difference_of_pic_nums_minus1)
571 picNumX = video->CurrPicNum - (difference_of_pic_nums_minus1 + 1);
606 void MemMgrCtrlOp3(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, uint difference_of_pic_nums_minus1,
611 picNumX = video->CurrPicNum - (difference_of_pic_nums_minus1 + 1);
640 void MemMgrCtrlOp4(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, uint max_long_term_frame_idx_plus1)
644 video->MaxLongTermFrameIdx = max_long_term_frame_idx_plus1 - 1;
649 if (dpb->fs[ii]->IsLongTerm && dpb->fs[ii] != video->currFS)
651 if (dpb->fs[ii]->LongTermFrameIdx > video->MaxLongTermFrameIdx)
661 void MemMgrCtrlOp5(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb)
665 video->MaxLongTermFrameIdx = -1;
668 if (dpb->fs[ii] != video->currFS) // MC_FIX
674 video->mem_mgr_ctrl_eq_5 = TRUE;
678 void MemMgrCtrlOp6(AVCHandle *avcHandle, AVCCommonObj *video, AVCDecPicBuffer *dpb, uint long_term_frame_idx)
682 video->currFS->IsLongTerm = 3;
683 video->currFS->IsReference = 3;
685 video->currPic->isLongTerm = TRUE;
686 video->currPic->isReference = TRUE;
687 video->currFS->LongTermFrameIdx = long_term_frame_idx;