?? mbuffer.c
字號(hào):
************************************************************************
*/
void free_storable_picture(StorablePicture* p)
{
if (p)
{
if (p->ref_idx)
{
free_mem3D ((byte***)p->ref_idx, 2);
p->ref_idx = NULL;
}
if (p->ref_pic_id)
{
free_mem3Dint64 (p->ref_pic_id, 6);
p->ref_pic_id = NULL;
}
if (p->ref_id)
{
free_mem3Dint64 (p->ref_id, 6);
p->ref_id = NULL;
}
if (p->mv)
{
free_mem4Dshort (p->mv, 2, p->size_y / BLOCK_SIZE);
p->mv = NULL;
}
if (p->moving_block)
{
free_mem2D (p->moving_block);
p->moving_block=NULL;
}
if (p->field_frame)
{
free_mem2D (p->field_frame);
p->field_frame=NULL;
}
#ifdef ADAPTIVE_FILTER
if(p->imgY_ups_aif)
{
free_mem2Dpel(p->imgY_ups_aif);
}
p->p_imgY_ups_aif=NULL;
//separable aif (BEGIN)
if(p->imgY_ups_aif_hor)
{
free_mem2Ddouble(p->imgY_ups_aif_hor);
}
p->imgY_ups_aif_hor=NULL;
//separable aif (END)
#ifdef E_DAIF
if (p->imgY_11_aif)
{
free (p->imgY_11_aif);
p->imgY_11_aif=NULL;
}
#endif // E_DAIF
#endif // ADAPTIVE_FILTER
#ifdef SWITCHED_FILTERS
if(p->imgY_filt)
{
free_mem2Dpel (p->imgY_filt);
p->imgY_filt = NULL;
}
if(p->imgY_11_filt)
{
free (p->imgY_11_filt);
p->imgY_11_filt = NULL;
}
p->p_imgY_filt = NULL;
p->p_imgY_11_filt = NULL;
#endif // SWITCHED_FILTERS
if (p->imgY)
{
free_mem2Dpel (p->imgY);
p->imgY=NULL;
}
if (p->imgY_11)
{
free (p->imgY_11);
p->imgY_11=NULL;
}
if (p->imgY_ups)
{
free_mem2Dpel (p->imgY_ups);
p->imgY_ups=NULL;
}
if (p->imgUV)
{
free_mem3Dpel (p->imgUV, 2);
p->imgUV=NULL;
}
if (input->WeightedPrediction || input->WeightedBiprediction || input->GenerateMultiplePPS)
{
{
free (p->imgY_11_w);
p->imgY_11_w=NULL;
}
if (p->imgY_ups_w)
{
free_mem2Dpel (p->imgY_ups_w);
p->imgY_ups_w=NULL;
}
}
if (p->mb_field)
{
free(p->mb_field);
p->mb_field=NULL;
}
free(p);
p = NULL;
}
}
/*!
************************************************************************
* \brief
* mark FrameStore unused for reference
*
************************************************************************
*/
static void unmark_for_reference(FrameStore* fs)
{
if (fs->is_used & 1)
{
if (fs->top_field)
{
fs->top_field->used_for_reference = 0;
}
}
if (fs->is_used & 2)
{
if (fs->bottom_field)
{
fs->bottom_field->used_for_reference = 0;
}
}
if (fs->is_used == 3)
{
if (fs->top_field && fs->bottom_field)
{
fs->top_field->used_for_reference = 0;
fs->bottom_field->used_for_reference = 0;
}
fs->frame->used_for_reference = 0;
}
fs->is_reference = 0;
if(fs->frame)
{
if (fs->frame->imgY_ups_w)
{
free_mem2Dpel (fs->frame->imgY_ups_w);
fs->frame->imgY_ups_w=NULL;
}
if (fs->frame->imgY_ups)
{
free_mem2Dpel (fs->frame->imgY_ups);
fs->frame->imgY_ups=NULL;
}
if (fs->frame->imgY_11_w)
{
free (fs->frame->imgY_11_w);
fs->frame->imgY_11_w=NULL;
}
#ifdef ADAPTIVE_FILTER
if (fs->frame->imgY_ups_aif)
{
free_mem2Dpel (fs->frame->imgY_ups_aif);
fs->frame->imgY_ups_aif=NULL;
}
//separable aif (BEGIN)
if (fs->frame->imgY_ups_aif_hor)
{
free_mem2Ddouble (fs->frame->imgY_ups_aif_hor);
fs->frame->imgY_ups_aif_hor=NULL;
}
//separable aif (END)
#ifdef E_DAIF
if (fs->frame->imgY_11_aif)
{
free (fs->frame->imgY_11_aif);
fs->frame->imgY_11_aif=NULL;
}
#endif // E_DAIF
#endif // ADAPTIVE_FILTER
if (fs->frame->ref_pic_id)
{
free_mem3Dint64 (fs->frame->ref_pic_id, 6);
fs->frame->ref_pic_id = NULL;
}
if (fs->frame->ref_id)
{
free_mem3Dint64 (fs->frame->ref_id, 6);
fs->frame->ref_id = NULL;
}
}
if (fs->top_field)
{
if (fs->top_field->imgY_ups_w)
{
free_mem2Dpel (fs->top_field->imgY_ups_w);
fs->top_field->imgY_ups_w=NULL;
}
if (fs->top_field->imgY_ups)
{
free_mem2Dpel (fs->top_field->imgY_ups);
fs->top_field->imgY_ups=NULL;
}
if (fs->top_field->imgY_11_w)
{
free (fs->top_field->imgY_11_w);
fs->top_field->imgY_11_w=NULL;
}
#ifdef ADAPTIVE_FILTER
if (fs->top_field->imgY_ups_aif)
{
free_mem2Dpel (fs->top_field->imgY_ups_aif);
fs->top_field->imgY_ups_aif=NULL;
}
#ifdef E_DAIF
if (fs->top_field->imgY_11_aif)
{
free (fs->top_field->imgY_11_aif);
fs->top_field->imgY_11_aif=NULL;
}
#endif // E_DAIF
#endif // ADAPTIVE_FILTER
if (fs->top_field->ref_pic_id)
{
free_mem3Dint64 (fs->top_field->ref_pic_id, 6);
fs->top_field->ref_pic_id = NULL;
}
if (fs->top_field->ref_id)
{
free_mem3Dint64 (fs->top_field->ref_id, 6);
fs->top_field->ref_id = NULL;
}
}
if (fs->bottom_field)
{
if (fs->bottom_field->imgY_ups_w)
{
free_mem2Dpel (fs->bottom_field->imgY_ups_w);
fs->bottom_field->imgY_ups_w=NULL;
}
if (fs->bottom_field->imgY_ups)
{
free_mem2Dpel (fs->bottom_field->imgY_ups);
fs->bottom_field->imgY_ups=NULL;
}
if (fs->bottom_field->imgY_11_w)
{
free (fs->bottom_field->imgY_11_w);
fs->bottom_field->imgY_11_w=NULL;
}
if (fs->bottom_field->ref_pic_id)
{
free_mem3Dint64 (fs->bottom_field->ref_pic_id, 6);
fs->bottom_field->ref_pic_id = NULL;
}
if (fs->bottom_field->ref_id)
{
free_mem3Dint64 (fs->bottom_field->ref_id, 6);
fs->bottom_field->ref_id = NULL;
}
}
}
/*!
************************************************************************
* \brief
* mark FrameStore unused for reference and reset long term flags
*
************************************************************************
*/
static void unmark_for_long_term_reference(FrameStore* fs)
{
if (fs->is_used & 1)
{
if (fs->top_field)
{
fs->top_field->used_for_reference = 0;
fs->top_field->is_long_term = 0;
}
}
if (fs->is_used & 2)
{
if (fs->bottom_field)
{
fs->bottom_field->used_for_reference = 0;
fs->bottom_field->is_long_term = 0;
}
}
if (fs->is_used == 3)
{
if (fs->top_field && fs->bottom_field)
{
fs->top_field->used_for_reference = 0;
fs->top_field->is_long_term = 0;
fs->bottom_field->used_for_reference = 0;
fs->bottom_field->is_long_term = 0;
}
fs->frame->used_for_reference = 0;
fs->frame->is_long_term = 0;
}
fs->is_reference = 0;
fs->is_long_term = 0;
}
/*!
************************************************************************
* \brief
* compares two stored pictures by picture number for qsort in descending order
*
************************************************************************
*/
static int compare_pic_by_pic_num_desc( const void *arg1, const void *arg2 )
{
if ( (*(StorablePicture**)arg1)->pic_num < (*(StorablePicture**)arg2)->pic_num)
return 1;
if ( (*(StorablePicture**)arg1)->pic_num > (*(StorablePicture**)arg2)->pic_num)
return -1;
else
return 0;
}
/*!
************************************************************************
* \brief
* compares two stored pictures by picture number for qsort in descending order
*
************************************************************************
*/
static int compare_pic_by_lt_pic_num_asc( const void *arg1, const void *arg2 )
{
if ( (*(StorablePicture**)arg1)->long_term_pic_num < (*(StorablePicture**)arg2)->long_term_pic_num)
return -1;
if ( (*(StorablePicture**)arg1)->long_term_pic_num > (*(StorablePicture**)arg2)->long_term_pic_num)
return 1;
else
return 0;
}
/*!
************************************************************************
* \brief
* compares two frame stores by pic_num for qsort in descending order
*
************************************************************************
*/
static int compare_fs_by_frame_num_desc( const void *arg1, const void *arg2 )
{
if ( (*(FrameStore**)arg1)->frame_num_wrap < (*(FrameStore**)arg2)->frame_num_wrap)
return 1;
if ( (*(FrameStore**)arg1)->frame_num_wrap > (*(FrameStore**)arg2)->frame_num_wrap)
return -1;
else
return 0;
}
/*!
************************************************************************
* \brief
* compares two frame stores by lt_pic_num for qsort in descending order
*
************************************************************************
*/
static int compare_fs_by_lt_pic_idx_asc( const void *arg1, const void *arg2 )
{
if ( (*(FrameStore**)arg1)->long_term_frame_idx < (*(FrameStore**)arg2)->long_term_frame_idx)
return -1;
if ( (*(FrameStore**)arg1)->long_term_frame_idx > (*(FrameStore**)arg2)->long_term_frame_idx)
return 1;
else
return 0;
}
/*!
************************************************************************
* \brief
* compares two stored pictures by poc for qsort in ascending order
*
************************************************************************
*/
static int compare_pic_by_poc_asc( const void *arg1, const void *arg2 )
{
if ( (*(StorablePicture**)arg1)->poc < (*(StorablePicture**)arg2)->poc)
return -1;
if ( (*(StorablePicture**)arg1)->poc > (*(StorablePicture**)arg2)->poc)
return 1;
else
return 0;
}
/*!
************************************************************************
* \brief
* compares two stored pictures by poc for qsort in descending order
*
************************************************************************
*/
static int compare_pic_by_poc_desc( const void *arg1, const void *arg2 )
{
if ( (*(StorablePicture**)arg1)->poc < (*(StorablePicture**)arg2)->poc)
return 1;
if ( (*(StorablePicture**)arg1)->poc > (*(StorablePicture**)arg2)->poc)
return -1;
else
return 0;
}
/*!
************************************************************************
* \brief
* compares two frame stores by poc for qsort in ascending order
*
************************************************************************
*/
static int compare_fs_by_poc_asc( const void *arg1, const void *arg2 )
{
if ( (*(FrameStore**)arg1)->poc < (*(FrameStore**)arg2)->poc)
return -1;
if ( (*(FrameStore**)arg1)->poc > (*(FrameStore**)arg2)->poc)
return 1;
else
return 0;
}
/*!
************************************************************************
* \brief
* compares two frame stores by poc for qsort in descending order
*
************************************************************************
*/
static int compare_fs_by_poc_desc( const void *arg1, const void *arg2 )
{
if ( (*(FrameStore**)arg1)->poc < (*(FrameStore**)arg2)->poc)
return 1;
if ( (*(FrameStore**)arg1)->poc > (*(FrameStore**)arg2)->poc)
return -1;
else
return 0;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -