コード例 #1
0
ファイル: ldecod.cpp プロジェクト: jonmcdonald/jpeg_platform
/*!
 ************************************************************************
 * \brief
 *    Free allocated memory of frame size related global buffers
 *    buffers are defined in global.h, allocated memory is allocated in
 *    int init_global_buffers()
 *
 * \par Input:
 *    Input Parameters struct inp_par *inp, Image Parameters struct img_par *img
 *
 * \par Output:
 *    none
 *
 ************************************************************************
 */
void free_global_buffers(struct inp_par *inp, struct img_par *img)
{
  free_mem2D (imgY_ref);
  free_mem3D (imgUV_ref,2);

#ifndef STATIC_ALLOC
  // CAVLC free mem
  free_mem3Dint(img->nz_coeff, img->FrameSizeInMbs);
  free_mem2Dint(img->siblock);

  // free mem, allocated for structure img
  if (img->mb_data       != NULL) free(img->mb_data);

  free (img->intra_block);
  free_mem2Dint (img->ipredmode);
#endif

  free_mem2Dint(img->field_anchor);

  free_mem3Dint(img->wp_weight, 2);
  free_mem3Dint(img->wp_offset, 2);
  free_mem4Dint(img->wbp_weight, 2, MAX_REFERENCE_PICTURES);

  global_init_done = 0;

}
コード例 #2
0
/*!
 ************************************************************************
 * \brief
 *    Free allocated memory of frame size related global buffers
 *    buffers are defined in global.h, allocated memory is allocated in
 *    int init_global_buffers()
 *
 * \par Input:
 *    Input Parameters struct inp_par *inp, Image Parameters struct img_par *img
 *
 * \par Output:
 *    none
 *
 ************************************************************************
 */
void free_global_buffers()
{
  free_mem2D (imgY_ref);
  free_mem3D (imgUV_ref,2);

  // CAVLC free mem
  free_mem3Dint(img->nz_coeff, img->oldFrameSizeInMbs);

  free_mem2Dint(img->siblock);

  // free mem, allocated for structure img
  if (img->mb_data       != NULL) free(img->mb_data);

  free (img->intra_block);

  free_mem2Dint (img->ipredmode);

  free_mem2Dint(img->field_anchor);

  free_mem3Dint(img->wp_weight, 2);
  free_mem3Dint(img->wp_offset, 6);
  free_mem4Dint(img->wbp_weight, 6, MAX_REFERENCE_PICTURES);

  global_init_done = 0;

}
コード例 #3
0
ファイル: mc_prediction.c プロジェクト: tanxuan231/jm18.5_key
void free_pred_mem(Slice *currSlice)
{
  free_mem2Dint(currSlice->tmp_res);
  free_mem2Dpel(currSlice->tmp_block_l0);
  free_mem2Dpel(currSlice->tmp_block_l1);
  free_mem2Dpel(currSlice->tmp_block_l2);
  free_mem2Dpel(currSlice->tmp_block_l3);
}
コード例 #4
0
ファイル: fast_me.c プロジェクト: VVer/JM86
void free_mem_FME()
{
  free_mem2Dint(McostState);
  free_mem_mincost (all_mincost);
  free_mem_bwmincost(all_bwmincost);

  free_mem2D(SearchState);
}
コード例 #5
0
/*!
************************************************************************
* \brief
*    Free allocated memory of frame size related global buffers
*    buffers are defined in global.h, allocated memory is allocated in
*    int init_global_buffers()
*
* \par Input:
*    Input Parameters struct inp_par *inp, Image Parameters struct img_par *img
*
* \par Output:
*    none
*
************************************************************************
*/
void free_global_buffers()
{
    free_mem2Dpel (imgY_ref);
    if (imgUV_ref)
        free_mem3Dpel (imgUV_ref,2);

    // CAVLC free mem
    free_mem3Dint(img->nz_coeff, img->oldFrameSizeInMbs);

    free_mem2Dint(img->siblock);

    // free mem, allocated for structure img
    if (img->mb_data       != NULL) free(img->mb_data);

    free (img->intra_block);

    free_mem2Dint (img->ipredmode);

    free_mem2Dint(img->field_anchor);

    free_mem3Dint(img->wp_weight, 2);
    free_mem3Dint(img->wp_offset, 6);
    free_mem4Dint(img->wbp_weight, 6, MAX_REFERENCE_PICTURES);

    free (img->quad);

#ifdef ADAPTIVE_FILTER
    free_mem2Ddouble (tmp_coef);
#endif

#ifdef ADAPTIVE_LOOP_FILTER
    FreeALFGlobalBurrers();
#endif

    global_init_done = 0;

}
コード例 #6
0
ファイル: memalloc.c プロジェクト: WGKONG/JM86_sectree
/*!
 ************************************************************************
 * \brief
 *    free 3D memory array 
 *    which was alocated with get_mem3Dint()
 ************************************************************************
 */
void free_mem3Dint(int ***array3D, int frames)
{
  int i;

  if (array3D)
  {
    for (i=0;i<frames;i++)
    { 
      free_mem2Dint(array3D[i]);
    }
   free (array3D);
  } else
  {
    error ("free_mem3D: trying to free unused memory",100);
  }
}
コード例 #7
0
ファイル: memalloc.c プロジェクト: shahid313/MSCourseWork
/*!
 ************************************************************************
 * \brief
 *    free 3D memory array 
 *    which was alocated with get_mem3Dint()
 *-----------------------------------------------------------------------			
 *	 Function Argument List Changed [Removing Global Variables] 
 *	 Input parameters added are 
 *			- h264_decoder* dec_params
 *
 *		<*****@*****.**>
 ************************************************************************
 */
void free_mem3Dint(int ***array3D, int frames)
{
  int i;

  if (array3D)
  {
    for (i=0;i<frames;i++)
    { 
      free_mem2Dint(array3D[i]);
    }
   h264_free (array3D);
  }
  else
  {
    printf("free_mem3D: trying to free unused memory");
	exit(0);
  }
}
コード例 #8
0
/*!
**************************************************************************************
* \brief 
*      free memory of error resilient RDO.  
**************************************************************************************
*/
void free_errdo_mem(VideoParameters *p_Vid)
{
  //for shared memory
  if (p_Vid->p_decs->res_img)
  {
    free_mem3Dint(p_Vid->p_decs->res_img);
    p_Vid->p_decs->res_img         = NULL;
  }
  if (p_Vid->p_decs->res_mb_best8x8)
  {
    free_mem3Dint(p_Vid->p_decs->res_mb_best8x8);
    p_Vid->p_decs->res_mb_best8x8         = NULL;
  }

  //for RMPC
  if (p_Vid->p_decs->RCD_bestY_mb)
  {
    free_mem2Dint(p_Vid->p_decs->RCD_bestY_mb);
    p_Vid->p_decs->RCD_bestY_mb         = NULL;
  }
  if (p_Vid->p_decs->RCD_bestY_b8x8)
  {
    free_mem3Dint(p_Vid->p_decs->RCD_bestY_b8x8);
    p_Vid->p_decs->RCD_bestY_b8x8         = NULL;
  }
  if (p_Vid->p_decs->MVCD_bestY_mb)
  {
    free_mem2Dint(p_Vid->p_decs->MVCD_bestY_mb);
    p_Vid->p_decs->MVCD_bestY_mb         = NULL;
  }
  if (p_Vid->p_decs->MVCD_bestY_b8x8)
  {
    free_mem3Dint(p_Vid->p_decs->MVCD_bestY_b8x8);
    p_Vid->p_decs->MVCD_bestY_b8x8         = NULL;
  }
  if (p_Vid->p_decs->flag_bestY_mb)
  {
    free_mem2D(p_Vid->p_decs->flag_bestY_mb);
    p_Vid->p_decs->flag_bestY_mb         = NULL;
  }
  if (p_Vid->p_decs->flag_bestY_b8x8)
  {
    free_mem3D(p_Vid->p_decs->flag_bestY_b8x8);
    p_Vid->p_decs->flag_bestY_b8x8         = NULL;
  }
  if (p_Vid->p_decs->flag_wo_res)
  {
    free_mem2D(p_Vid->p_decs->flag_wo_res);
    p_Vid->p_decs->flag_wo_res         = NULL;
  }
  if (p_Vid->p_decs->flag_wo_res_bestY_b8x8)
  {
    free_mem3D(p_Vid->p_decs->flag_wo_res_bestY_b8x8);
    p_Vid->p_decs->flag_wo_res_bestY_b8x8         = NULL;
  }
  if (p_Vid->p_decs->trans_dist_bestY_mb)
  {
    free_mem2Dint(p_Vid->p_decs->trans_dist_bestY_mb);
    p_Vid->p_decs->trans_dist_bestY_mb         = NULL;
  }
  if (p_Vid->p_decs->trans_dist_bestY_b8x8)
  {
    free_mem3Dint(p_Vid->p_decs->trans_dist_bestY_b8x8);
    p_Vid->p_decs->trans_dist_bestY_b8x8         = NULL;
  }
  if (p_Vid->p_decs->trans_dist_wo_res)
  {
    free_mem2Dint(p_Vid->p_decs->trans_dist_wo_res);
    p_Vid->p_decs->trans_dist_wo_res         = NULL;   //it is used for P8x8, where residual may be set to 0
  }
  if (p_Vid->p_decs->trans_dist_wo_res_bestY_b8x8)
  {
    free_mem3Dint(p_Vid->p_decs->trans_dist_wo_res_bestY_b8x8);
    p_Vid->p_decs->trans_dist_wo_res_bestY_b8x8   = NULL;   //it is used for P8x8, where residual may be set to 0
  }
  if (p_Vid->p_decs->trans_err_bestY_mb)
  {
    free_mem2Dint(p_Vid->p_decs->trans_err_bestY_mb);
    p_Vid->p_decs->trans_err_bestY_mb         = NULL;
  }
  if (p_Vid->p_decs->trans_err_bestY_b8x8)
  {
    free_mem3Dint(p_Vid->p_decs->trans_err_bestY_b8x8);
    p_Vid->p_decs->trans_err_bestY_b8x8         = NULL;
  }
  if (p_Vid->p_decs->trans_err_wo_res)
  {
    free_mem2Dint(p_Vid->p_decs->trans_err_wo_res);
    p_Vid->p_decs->trans_err_wo_res         = NULL;   //it is used for P8x8, where residual may be set to 0
  }
  if (p_Vid->p_decs->trans_err_wo_res_bestY_b8x8)
  {   
    free_mem3Dint(p_Vid->p_decs->trans_err_wo_res_bestY_b8x8);
    p_Vid->p_decs->trans_err_wo_res_bestY_b8x8   = NULL;   //it is used for P8x8, where residual may be set to 0
  }

  //for LLN
  if (p_Vid->p_decs->dec_mb_pred)
  {
    free_mem3Dpel(p_Vid->p_decs->dec_mb_pred);
    p_Vid->p_decs->dec_mb_pred         = NULL;
  }
  if (p_Vid->p_decs->dec_mbY_best)
  {
    free_mem3Dpel(p_Vid->p_decs->dec_mbY_best);
    p_Vid->p_decs->dec_mbY_best        = NULL;
  }
  if (p_Vid->p_decs->dec_mbY_best8x8)
  {   
    free_mem4Dpel(p_Vid->p_decs->dec_mbY_best8x8);
    p_Vid->p_decs->dec_mb_pred_best8x8 = NULL;
  }
  if (p_Vid->p_decs->dec_mb_pred_best8x8)
  {
    free_mem4Dpel(p_Vid->p_decs->dec_mb_pred_best8x8);
    p_Vid->p_decs->dec_mbY_best8x8     = NULL;
  }

  //for ROPE
  if (p_Vid->p_decs->first_moment_bestY_mb)
  {
    free_mem2Dpel(p_Vid->p_decs->first_moment_bestY_mb);
    p_Vid->p_decs->first_moment_bestY_mb         = NULL;
  }
  if (p_Vid->p_decs->first_moment_bestY_b8x8)
  {
    free_mem3Dpel(p_Vid->p_decs->first_moment_bestY_b8x8);
    p_Vid->p_decs->first_moment_bestY_b8x8       = NULL;
  }
  if (p_Vid->p_decs->first_moment_pred_bestY_b8x8)
  {
    free_mem3Dpel(p_Vid->p_decs->first_moment_pred_bestY_b8x8);
    p_Vid->p_decs->first_moment_pred_bestY_b8x8       = NULL;
  }
  if (p_Vid->p_decs->first_moment_pred)
  {
    free_mem2Dpel(p_Vid->p_decs->first_moment_pred);
    p_Vid->p_decs->first_moment_pred       = NULL;
  }
  if (p_Vid->p_decs->second_moment_bestY_mb)
  {
    free_mem2Duint16(p_Vid->p_decs->second_moment_bestY_mb);
    p_Vid->p_decs->second_moment_bestY_mb        = NULL;
  }
  if (p_Vid->p_decs->second_moment_bestY_b8x8)
  {
    free_mem3Duint16(p_Vid->p_decs->second_moment_bestY_b8x8);
    p_Vid->p_decs->second_moment_bestY_b8x8      = NULL;
  }
  if (p_Vid->p_decs->second_moment_pred_bestY_b8x8)
  {
    free_mem3Duint16(p_Vid->p_decs->second_moment_pred_bestY_b8x8);
    p_Vid->p_decs->second_moment_pred_bestY_b8x8      = NULL;
  }
  if (p_Vid->p_decs->second_moment_pred)
  {
    free_mem2Duint16(p_Vid->p_decs->second_moment_pred);
    p_Vid->p_decs->second_moment_pred      = NULL;
  }


  if ( p_Vid->p_decs != NULL )
  {
    free( p_Vid->p_decs );
    p_Vid->p_decs = NULL;
  }
}
コード例 #9
0
/*!
 *************************************************************************************
 * \brief
 *    free storable picture memory for errdo
 *
 *************************************************************************************
 */
void errdo_free_storable_picture(StorablePicture* s)
{
  int nplane;
  Dist_Estm *p = s->de_mem;
  //free memory for RMPC and extended RMPC algorithms
  if (p->res_con_diff_Y)
  {
    free_mem2Dint(p->res_con_diff_Y);
    p->res_con_diff_Y   = NULL;
  }
  if (p->res_con_diff_UV)
  {
    free_mem3Dint(p->res_con_diff_UV);
    p->res_con_diff_UV   = NULL;
  }
  for (nplane = 0; nplane < 3; nplane++)
  {
    p->p_res_con_diff[nplane] = NULL;
  }

  if (p->MV_con_diff_Y)
  {
    free_mem2Dint(p->MV_con_diff_Y);
    p->MV_con_diff_Y   = NULL;
  }
  if (p->MV_con_diff_UV)
  {
    free_mem3Dint(p->MV_con_diff_UV);
    p->MV_con_diff_UV   = NULL;
  }
  for (nplane = 0; nplane < 3; nplane++)
  {
    p->p_MV_con_diff[nplane] = NULL;
  }

  if (p->error_sign_flag_Y)
  {
    free_mem2D(p->error_sign_flag_Y);
    p->error_sign_flag_Y   = NULL;
  } 
  if (p->error_sign_flag_UV)
  {
    free_mem3D(p->error_sign_flag_UV);
    p->error_sign_flag_UV   = NULL;
  }
  for (nplane = 0; nplane < 3; nplane++)
  {
    p->p_error_sign_flag[nplane] = NULL;
  }

  if (p->transmission_dist_Y)
  {
    free_mem2Dint(p->transmission_dist_Y);
    p->transmission_dist_Y   = NULL;
  }
  if (p->transmission_dist_UV)
  {
    free_mem3Dint(p->transmission_dist_UV);
    p->transmission_dist_UV   = NULL;
  }
  for (nplane = 0; nplane < 3; nplane++)
  {
    p->p_transmission_dist[nplane] = NULL;
  }

  if (p->transmission_err_Y)
  {
    free_mem2Dint(p->transmission_err_Y);
    p->transmission_err_Y   = NULL;
  }
  if (p->transmission_err_UV)
  {
    free_mem3Dint(p->transmission_err_UV);
    p->transmission_err_UV   = NULL;
  }
  for (nplane = 0; nplane < 3; nplane++)
  {
    p->p_transmission_err[nplane] = NULL;
  }

  //free memory for LLN and Faster LLN algorithms
  if (p->dec_imgY)
  {
    free_mem3Dpel(p->dec_imgY);
    p->dec_imgY   = NULL;
  }
  if (p->dec_imgUV)
  {
    free_mem4Dpel(p->dec_imgUV);
    p->dec_imgUV  = NULL;
  }
  for (nplane = 0; nplane < 3; nplane++)
  {
    if (p->p_dec_img[nplane])
    {  
      free(p->p_dec_img[nplane]);
      p->p_dec_img[nplane] = NULL;
    }
  }
  if (p->mb_error_map)
  {
    free_mem3D(p->mb_error_map);
    p->mb_error_map = NULL;
  }


  //free memory for ROPE and extended ROPE algorithms
  if (p->first_moment_Y)
  {
    free_mem2Dpel(p->first_moment_Y);
    p->first_moment_Y   = NULL;
  }
  if (p->first_moment_UV)
  {
    free_mem3Dpel(p->first_moment_UV);
    p->first_moment_UV  = NULL;
  }
  for (nplane = 0; nplane < 3; nplane++)
  {
    p->p_first_moment[nplane] = NULL;
  }
  if (p->second_moment_Y)
  {
    free_mem2Duint16(p->second_moment_Y);
    p->second_moment_Y   = NULL;
  }
  if (p->second_moment_UV)
  {
    free_mem3Duint16(p->second_moment_UV);
    p->second_moment_UV  = NULL;
  }
  for (nplane = 0; nplane < 3; nplane++)
  {
    p->p_second_moment[nplane] = NULL;
  }

  if (s->de_mem)
  {
    free(s->de_mem);
    s->de_mem   = NULL;
  }
}