/**
    \fn vdpauRefDownload
    \brief Convert a VASurface image to a regular image
*/
static bool libvaRefDownload(ADMImage *image, void *instance, void *cookie)
{
    decoderFFLIBVA *inst=(decoderFFLIBVA *)instance ;
    ADM_vaSurface *s=(ADM_vaSurface *) cookie;
    bool r=s->toAdmImage(image);
    image->refType=ADM_HW_NONE;
    libvaMarkSurfaceUnused(instance,cookie);
    return r;
}
/**
    \fn releaseBuffer
*/
void decoderFFLIBVA::releaseBuffer(AVCodecContext *avctx, AVFrame *pic)
{
  uint64_t p=(uint64_t )pic->data[0];
  VASurfaceID s=(VASurfaceID)p;
  decoderFFLIBVA *x=(decoderFFLIBVA *)avctx->opaque;
    
  ADM_vaSurface *i=lookupBySurfaceId(s);
  
  aprintf("Release Buffer : 0x%llx\n",s);
  
  for(int i=0; i<4; i++)
  {
    pic->data[i]= NULL;
  }
  
  libvaMarkSurfaceUnused(i,this);
  
}