Ejemplo n.º 1
0
void ad_pic_gif_init(void)
{
	struct gif_cfg init;

	if(gif != NULL)
		return ;
    
	MEMSET((void *)&init,0,sizeof(struct gif_cfg));

	init.bit_buf_start = (UINT8 *)((__MM_IMAGEDEC_BUF_ADDR+0x10000) & ~(3<<29));//(UINT8 *)(__MM_GIF_BIT_ADDR & ~(7<<28));
	                                                                        //the size of processing pic is less than 0x10000
	init.bit_buf_size =  0X8000;  
	init.dec_buf_start = (UINT8 *)((__MM_IMAGEDEC_BUF_ADDR+0x18000) & ~(3<<29)); //(UINT8 *)(__MM_GIF_DEC_ADDR & ~(7<<28));
	init.dec_buf_size =  0x60000;  //0x5E600 = 360(d)*240(d)*4+0xa000

	init.fread_callback = gif_read_data;
	init.fseek_callback = gif_seek_data;
	init.ftell_callback = gif_tell_pos;	
	init.max_width = 360; 
	init.max_height = 240; 
	
	gif_init(&init);
	gif_list_init();
	gif = gif_open();
}
Ejemplo n.º 2
0
static void pic_gif_init(void)
{
	struct osd_device  *osd_layer2_dev;
	struct gif_cfg init;

    osd_layer2_dev =(struct osd_device*)dev_get_by_id(HLD_DEV_TYPE_OSD, 0);
    if (osd_layer2_dev == NULL)
	{
		AD_GIF_PRINTF("%s() OSD_layer2 is not be opened!\n", __FUNCTION__);
	}
    else
    {
        OSDDrv_Close((HANDLE)osd_layer2_dev);
        AD_GIF_PRINTF("%s() OSD_layer2 is closed!\n", __FUNCTION__);
    }
#ifdef  DUAL_ENABLE
    osd_output_init();
#endif
	MEMSET((void *)&init,0,sizeof(struct gif_cfg));

	init.bit_buf_start = (UINT8 *)((__MM_MP_BUFFER_ADDR +0x800000)& ~(7<<28));//(UINT8 *)(GIF_BIT_BUF& ~(7<<28));//
	init.bit_buf_size =  0x200000;//GIF_BIT_SIZE;//
	init.dec_buf_start = (UINT8 *)((__MM_MP_BUFFER_ADDR +0xa00000)& ~(7<<28));//(UINT8 *)(GIF_DEC_BUF& ~(7<<28));//
	init.dec_buf_size =  (__MM_PVR_VOB_BUFFER_LEN -0xa00000 );//GIF_DEC_SIZE;//__MM_PVR_VOB_BUFFER_ADDR
 
	init.fread_callback = gif_read_data;
	init.fseek_callback = gif_seek_data;
	init.ftell_callback = gif_tell_pos;	
	init.max_width = 800; //400; 
	init.max_height = 600; //300; 
	
	gif_init(&init);
	//gif_list_init();
	gif = gif_open();
}
Ejemplo n.º 3
0
Archivo: gif.c Proyecto: 4nykey/rockbox
static int load_image(char *filename, struct image_info *info,
                      unsigned char *buf, ssize_t *buf_size)
{
    int w, h;
    long time = 0; /* measured ticks */
    struct gif_decoder *p_decoder = &decoder;

    unsigned char *memory, *memory_max;
    size_t memory_size, img_size, disp_size;

    /* align buffer */
    memory = (unsigned char *)((intptr_t)(buf + 3) & ~3);
    memory_max = (unsigned char *)((intptr_t)(memory + *buf_size) & ~3);
    memory_size = memory_max - memory;

#ifdef DISK_SPINDOWN
        if (iv->running_slideshow && iv->immediate_ata_off) {
            /* running slideshow and time is long enough: power down disk */
            rb->storage_sleep();
        }
#endif

        /* initialize decoder context struct, set buffer decoder is free 
         * to use.
         */
        gif_decoder_init(p_decoder, memory, memory_size);

        /* populate internal data from gif file control structs */
        gif_open(filename, p_decoder);

        if (!p_decoder->error)
        {

            if (!iv->running_slideshow)
            {
                rb->lcd_putsf(0, 2, "image %dx%d",
                              p_decoder->width,
                              p_decoder->height);
                rb->lcd_putsf(0, 3, "decoding %d*%d",
                              p_decoder->width,
                              p_decoder->height);
                rb->lcd_update();
            }

            /* the actual decoding */
            time = *rb->current_tick;

#ifdef HAVE_ADJUSTABLE_CPU_FREQ
            rb->cpu_boost(true);
#endif
            gif_decode(p_decoder, iv->cb_progress);

#ifdef HAVE_ADJUSTABLE_CPU_FREQ
            rb->cpu_boost(false);
#endif
            time = *rb->current_tick - time;
        }

    if (!iv->running_slideshow && !p_decoder->error)
    {
        rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ);
        rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */
        rb->lcd_putsxy((LCD_WIDTH - w)/2, LCD_HEIGHT - h, print);
        rb->lcd_update();
    }

    if (p_decoder->error)
    {
        rb->splashf(HZ, "%s", GifErrorString(p_decoder->error));
        return PLUGIN_ERROR;
    }

    info->x_size = p_decoder->width;
    info->y_size = p_decoder->height;
    info->frames_count = p_decoder->frames_count;
    info->delay = p_decoder->delay;

    /* check mem constraints
     * each frame can have 4 scaled versions with ds = (1,2,4,8)
     */
    img_size = (p_decoder->native_img_size*p_decoder->frames_count + 3) & ~3;
    disp_size = (sizeof(unsigned char *)*p_decoder->frames_count*4 + 3) & ~3;

    if (memory_size < img_size + disp_size)
    {
        /* No memory to allocate disp matrix */
        rb->splashf(HZ, "%s", GifErrorString(D_GIF_ERR_NOT_ENOUGH_MEM));
        return PLUGIN_ERROR;
    }

    disp = (unsigned char **)(p_decoder->mem + img_size);
    disp_buf = (unsigned char *)disp + disp_size;

    *buf_size = memory_max - disp_buf;

    /* set all pointers to NULL initially */
    memset(disp, 0, sizeof(unsigned char *)*p_decoder->frames_count*4);

    return PLUGIN_OK;
}