Exemple #1
0
//mickey
static s32 fbm_alloc_yv12_frame_buffer(vpicture_t* picture)
{
    picture->y 	   = NULL;
    picture->u 	   = NULL;
    picture->v 	   = NULL;
    picture->alpha = NULL;

    picture->y2	   	 = NULL;
    picture->v2	  	 = NULL;
    picture->u2	  	 = NULL;
    picture->alpha2  = NULL;

	if(picture->size_y != 0)
 	{
 		picture->y = (u8*)mem_palloc(picture->size_y + picture->size_u*2, 16);
 		if(picture->y == NULL)
 			goto _exit;

 	}

	return 0;

_exit:

	if(picture->y != NULL)
	{
		mem_pfree(picture->y);
		picture->y = NULL;
	}

	return -1;
}
Exemple #2
0
void vbv_release(Handle vbv)
{
    vbv_t* v;
    
    v = (vbv_t*)vbv;
    printf("vbv releasae\n");
    if (v)
    {
        if (v->mutex != NULL)
        {
        	semaphore_delete(v->mutex, SEM_DEL_ALWAYS);
            v->mutex = NULL;
        }

        if (v->vbv_buf != NULL)
        {
            mem_pfree(v->vbv_buf);
            v->vbv_buf = NULL;
        }

        if (v->frame_fifo.in_frames)
        {
            mem_free(v->frame_fifo.in_frames);
            v->frame_fifo.in_frames = NULL;
        }

        mem_free(v);
    }

    return;	
}
Exemple #3
0
s32 fbm_free_redBlue_frame_buffer(Handle h)
{   
    u32 i = 0;
    fbm_t* 		  fbm = NULL;
    vpicture_t*   picture = NULL;

    fbm = (fbm_t*)h;
    
    if (lock(fbm) != 0)
    {
        return -1;
    }
    for(i=0; i<fbm->max_frame_num; i++)
 	{   
        picture = &fbm->frames[i].picture;
        if(picture->y2 != NULL)
	    {
 		    mem_pfree(picture->y2);
 		    picture->y2 = NULL;
 	    }
	
 	    if(picture->u2 != NULL)
	    {
 		    mem_pfree(picture->u2);
 		    picture->u2 = NULL;
 	    }
	
 	    if(picture->v2 != NULL)
	    {
 		    mem_pfree(picture->v2);
 		    picture->v2 = NULL;
 	    }
	
 	    if(picture->alpha2 != NULL)
	    {
 		    mem_pfree(picture->alpha2);
 		    picture->alpha2 = NULL;
 	    }
    }
   unlock(fbm);  
   return 0;
}
Exemple #4
0
static s32 fbm_free_frame_buffer(vpicture_t* picture)
{
 	if(picture->y != NULL)
 	{
 		mem_pfree(picture->y);
 		picture->y = NULL;
 	}
 	
 	if(picture->u != NULL)
 	{
 		mem_pfree(picture->u);
 		picture->u = NULL;
 	}
 	
 	if(picture->v != NULL)
 	{
 		mem_pfree(picture->v);
 		picture->v = NULL;
 	}
 	
 	if(picture->alpha != NULL)
 	{
 		mem_pfree(picture->alpha);
 		picture->alpha = NULL;
	}
	
 	if(picture->y2 != NULL)
	{
 		mem_pfree(picture->y2);
 		picture->y2 = NULL;
 	}
	
 	if(picture->u2 != NULL)
	{
 		mem_pfree(picture->u2);
 		picture->u2 = NULL;
 	}
	
 	if(picture->v2 != NULL)
	{
 		mem_pfree(picture->v2);
 		picture->v2 = NULL;
 	}
	
 	if(picture->alpha2 != NULL)
	{
 		mem_pfree(picture->alpha2);
 		picture->alpha2 = NULL;
 	}
 	return 0;
}
Exemple #5
0
static void fbm_free_frame_buffer(cedarx_picture_t* picture)
{
    if(picture->y[0] && picture->size_y[0]) {
        mem_pfree(picture->y[0]);
        picture->y[0] = NULL;
        picture->size_y[0] = 0;
    }
    
    if(picture->u[0] && picture->size_u[0]) {
        mem_pfree(picture->u[0]);
        picture->u[0] = NULL;
        picture->size_u[0] = 0;
    }
    
    if(picture->v[0] && picture->size_v[0]) {
        mem_pfree(picture->v[0]);
        picture->v[0] = NULL;
        picture->size_v[0] = 0;
    }
    
    if(picture->alpha[0] && picture->size_alpha[0]) {
        mem_pfree(picture->alpha[0]);
        picture->alpha[0] = NULL;
        picture->size_alpha[0] = 0;
    }
    
    if(picture->y[1] && picture->size_y[1]) {
        mem_pfree(picture->y[1]);
        picture->y[1] = NULL;
        picture->size_y[1] = 0;
    }
    
    if(picture->u[1] && picture->size_u[1]) {
        mem_pfree(picture->u[1]);
        picture->u[1] = NULL;
        picture->size_u[1] = 0;
    }
    
    if(picture->v[1] && picture->size_v[1]) {
        mem_pfree(picture->v[1]);
        picture->v[1] = NULL;
        picture->size_v[1] = 0;
    }
    
    if(picture->alpha[1] && picture->size_alpha[1]) {
        mem_pfree(picture->alpha[1]);
        picture->alpha[1] = NULL;
        picture->size_alpha[1] = 0;
    }
}
Exemple #6
0
static void vbv_exit(Handle h)
{
    vbv_t* vbv = (vbv_t*)h;

    if (vbv) {
        pthread_mutex_destroy(&vbv->mutex);

        if (vbv->frame_fifo.in_frames) {
            mem_free(vbv->frame_fifo.in_frames);
        }
        
        if (vbv->vbv_buf) {
            mem_pfree(vbv->vbv_buf);
        }

        mem_free(vbv);
    }
}
Exemple #7
0
/*
 * Dispose, Free all resources
 */
void CDVDVideoCodecA10::Dispose()
{
  if (m_yuvdata)
  {
    mem_pfree(m_yuvdata);
    m_yuvdata = NULL;
  }
  scaler_close();
  disp_close();
  if (m_hcedarv)
  {
    m_hcedarv->ioctrl(m_hcedarv, CEDARV_COMMAND_STOP, 0);
    m_hcedarv->close(m_hcedarv);
    libcedarv_exit(m_hcedarv);
    m_hcedarv = NULL;
    cas(&g_cedaropen, 1, 0);
    CLog::Log(LOGDEBUG, "A10: cedar dispose.");
  }
}
Exemple #8
0
s32 libcedarv_exit(cedarv_decoder_t* p)
{
    video_decoder_t* decoder;

    if(p == NULL)
        return CEDARV_RESULT_ERR_INVALID_PARAM;

    decoder = (video_decoder_t*)p;

    if(decoder->stream_info.init_data != NULL)
    {
        mem_free(decoder->stream_info.init_data);
        decoder->stream_info.init_data = NULL;
    }

	if(decoder->cedarv_output_viraddr != NULL)
	{
		mem_pfree(decoder->cedarv_output_viraddr);
	}

    if(decoder->vbv != NULL)
    {
        vbv_release(decoder->vbv);
        decoder->vbv = NULL;
    }

    if(decoder->ve != NULL)
    {
        libve_close(0, decoder->ve);
        decoder->ve = NULL;
        decoder->fbm = NULL;
    }

    mem_free(decoder);
    g_vdecoder = NULL;

    cedardev_exit();

    return CEDARV_RESULT_OK;
}
Exemple #9
0
Handle vbv_init(u32 vbv_size, u32 max_frame_num)
{
    u32    i;
    u8*    vbv_buf;
    vbv_t* vbv;
    
    if(vbv_size == 0 || max_frame_num == 0)
        return NULL;
    
    vbv_buf = (u8*)mem_palloc(vbv_size, 1024);
    if (vbv_buf == NULL)
        return NULL;

    vbv = (vbv_t*)mem_alloc(sizeof(vbv_t));
    if (vbv == NULL)
    {
        mem_pfree(vbv_buf);
        return NULL;
    }
    mem_set(vbv, 0, sizeof(vbv_t));

    vbv->frame_fifo.in_frames = (stream_frame_t*)mem_alloc(max_frame_num*sizeof(stream_frame_t));
    if (vbv->frame_fifo.in_frames == NULL)
    {
        mem_free(vbv);
        mem_pfree(vbv_buf);
        return NULL;
    }
    
    printf("vbv init\n");
    mem_set(vbv->frame_fifo.in_frames, 0, max_frame_num*sizeof(stream_frame_t));
    for(i=0; i<max_frame_num; i++)
    {
        vbv->frame_fifo.in_frames[i].id = i;
    }
    
    vbv->mutex = semaphore_create(1);
    if (vbv->mutex == NULL)
    {
        mem_free(vbv->frame_fifo.in_frames);
        mem_free(vbv);
        mem_pfree(vbv_buf);
        return NULL;
    }

    vbv->vbv_buf     = vbv_buf;
    vbv->max_size    = vbv_size;
    vbv->vbv_buf_end = vbv_buf + vbv_size - 1;
    vbv->read_addr   = vbv_buf;
    vbv->write_addr  = vbv->vbv_buf;
    vbv->valid_size  = 0;

    vbv->frame_fifo.frame_num     = 0;
    vbv->frame_fifo.read_index    = 0;
    vbv->frame_fifo.write_index   = 0;
    vbv->frame_fifo.max_frame_num = max_frame_num;
    
    vbv->frame_queue.frame_num = 0;
    vbv->frame_queue.head      = NULL;
    
    return (Handle)vbv;
}
Exemple #10
0
static s32 fbm_alloc_frame_buffer(vpicture_t* picture)
{
    picture->y 	   = NULL;
    picture->u 	   = NULL;
    picture->v 	   = NULL;
    picture->alpha = NULL;
    
    picture->y2	   	 = NULL;
    picture->v2	  	 = NULL;
    picture->u2	  	 = NULL;
    picture->alpha2  = NULL;


	if(picture->size_y != 0)
 	{
 		picture->y = (u8*)mem_palloc(picture->size_y, 1024);
 		if(picture->y == NULL)
 			goto _exit;

 	}
    
 	if(picture->size_u != 0)
 	{
 		picture->u = (u8*)mem_palloc(picture->size_u, 1024);
 		if(picture->u == NULL)
 		{
 			goto _exit;
 		}
 	}
    
 	if(picture->size_v != 0)
 	{
 		picture->v = (u8*)mem_palloc(picture->size_v, 1024);
 		if(picture->v == NULL)
 		{
 			goto _exit;
 		}
 	}

 	if(picture->size_alpha != 0)
 	{
 		picture->alpha = (u8*)mem_palloc(picture->size_alpha, 1024);
 		if(picture->alpha == NULL)
 		{
 			goto _exit;
 		}
 	}
	return 0;

_exit:
	if(picture->v != NULL)
	{
		mem_pfree(picture->v);
		picture->v = NULL;
	}
	if(picture->u != NULL)
	{
		mem_pfree(picture->u);
		picture->u = NULL;
	}
	if(picture->y != NULL)
	{
		mem_pfree(picture->y);
		picture->y = NULL;
	}
	if(picture->alpha != NULL){
		mem_pfree(picture->alpha);
		picture->alpha = NULL;
	}
	return -1;
}