static int jpeg_init(struct pe_image_cfg *pe_image_cfg) { struct vpo_device * pvpo_sd; MEMSET(&jpeg_file, 0, sizeof(jpeg_file)); jpeg_file.init_conf.frm_y_size = pe_image_cfg->frm_y_size; jpeg_file.init_conf.frm_y_addr = pe_image_cfg->frm_y_addr; jpeg_file.init_conf.frm_c_size = pe_image_cfg->frm_c_size; jpeg_file.init_conf.frm_c_addr = pe_image_cfg->frm_c_addr; jpeg_file.init_conf.frm2_y_size = pe_image_cfg->frm2_y_size; jpeg_file.init_conf.frm2_y_addr = pe_image_cfg->frm2_y_addr; jpeg_file.init_conf.frm2_c_size = pe_image_cfg->frm2_c_size; jpeg_file.init_conf.frm2_c_addr = pe_image_cfg->frm2_c_addr; jpeg_file.init_conf.decoder_buf = pe_image_cfg->decoder_buf; jpeg_file.init_conf.frm3_y_size = pe_image_cfg->frm3_y_size; jpeg_file.init_conf.frm3_y_addr = pe_image_cfg->frm3_y_addr; jpeg_file.init_conf.frm3_c_size = pe_image_cfg->frm3_c_size; jpeg_file.init_conf.frm3_c_addr = pe_image_cfg->frm3_c_addr; pvpo_sd = (struct vpo_device *)dev_get_by_id(HLD_DEV_TYPE_DIS, 1); if(NULL != pvpo_sd) { jpeg_file.init_conf.frm4_y_size = pe_image_cfg->frm4_y_size; jpeg_file.init_conf.frm4_y_addr = pe_image_cfg->frm4_y_addr; jpeg_file.init_conf.frm4_c_size = pe_image_cfg->frm4_c_size; jpeg_file.init_conf.frm4_c_addr = pe_image_cfg->frm4_c_addr; } jpeg_file.init_conf.decoder_buf_len = pe_image_cfg->decoder_buf_len; jpeg_file.init_conf.fread_callback = NULL,//jpg_read_data; jpeg_file.init_conf.fseek_callback = NULL,//jpg_seek_data; jpeg_file.init_conf.imagedec_status = jpeg_process; if(sys_ic_get_chip_id()==ALI_S3602 || sys_ic_get_chip_id()==ALI_S3602F ||sys_ic_get_chip_id()==ALI_S3811) jpeg_file.init_conf.frm_mb_type = 1; else jpeg_file.init_conf.frm_mb_type = 0; #ifdef ENABLE_PE_CACHE jpeg_file.init_conf.decoder_buf_len -= GIF_CACHE_SIZE; gif_cache_buffer = (unsigned char *)(((unsigned long)jpeg_file.init_conf.decoder_buf) & 0xfffffff0); gif_cache_buffer = (unsigned char *)(((unsigned long)gif_cache_buffer & 0x0fffffff) | 0x80000000); jpeg_file.init_conf.decoder_buf = jpeg_file.init_conf.decoder_buf + GIF_CACHE_SIZE; #endif jpeg_file.id = imagedec_init(&jpeg_file.init_conf); jpeg_file.lock = osal_mutex_create(); //pic_gif_init(); }
//the parameter of rect is the showing region on GE static INT32 ad_pic_img_dec(struct OSDRect *rect) { imagedec_id id = 0; UINT32 file_handle = 0xFF; BOOL ret = 0; Imagedec_Init_Config img_init_info; MEMSET(&img_init_info,0,sizeof(Imagedec_Init_Config)); img_init_info.frm_y_size = __MM_FB0_Y_LEN; img_init_info.frm_y_addr = __MM_FB0_Y_START_ADDR; img_init_info.frm_c_size = __MM_FB0_C_LEN; img_init_info.frm_c_addr = __MM_FB0_C_START_ADDR; img_init_info.frm2_y_size = __MM_FB1_Y_LEN; img_init_info.frm2_y_addr = __MM_FB1_Y_START_ADDR; img_init_info.frm2_c_size = __MM_FB1_C_LEN; img_init_info.frm2_c_addr = __MM_FB1_C_START_ADDR; img_init_info.frm3_y_size = __MM_FB2_Y_LEN; img_init_info.frm3_y_addr = __MM_FB2_Y_START_ADDR; img_init_info.frm3_c_size = __MM_FB2_C_LEN; img_init_info.frm3_c_addr = __MM_FB2_C_START_ADDR; img_init_info.frm_mb_type = 0; img_init_info.decoder_buf = (UINT8 *)((__MM_IMAGEDEC_BUF_ADDR+0x10000) & ~(3<<29));//__MM_IMG_DEC_ADDR; img_init_info.decoder_buf_len = 0x54600; //0x7E800;//0x3FA40; // 0x3FA40=320*240*1.5+0x20000 ;0x15180=320*240//__MM_IMG_DEC_LEN; img_init_info.fread_callback = img_read_data; img_init_info.fseek_callback = img_seek_data; id = imagedec_init(&img_init_info); if(0 == id) { AD_IMG_PRINTF("%s() imagedec_init failed(%d)!\n", __FUNCTION__, id); return !SUCCESS; } if (TRUE != imagedec_ioctl(id, IMAGEDEC_IO_CMD_OPEN_HW_ACCE, 0)) { AD_IMG_PRINTF("%s() imagedec_ioctl(IMAGEDEC_IO_CMD_OPEN_HW_ACCE) failed!\n", __FUNCTION__); return !SUCCESS; } Imagedec_Osd_Config config; MEMSET((void *)&config, 0, sizeof(Imagedec_Osd_Config)); config.blt = ad_pic_img_blt; config.handle = (void *)ad_pic_get_ge_surface(AD_DST_SURFACE); config.pic_frmt = 0; imagedec_osd_init(&config); Imagedec_Mode_Par dec_par; MEMSET((void *)&dec_par,0,sizeof(Imagedec_Mode_Par)); dec_par.vp_close_control = 0; dec_par.pro_show = 1; dec_par.dis_rect.uStartX = 0; //rect->uLeft; dec_par.dis_rect.uStartY = 0; dec_par.dis_rect.uWidth = 720;//rect->uWidth; dec_par.dis_rect.uHeight = 576;//rect->uHeight; dec_par.src_rect.uStartX = 0;//rect->uLeft; dec_par.src_rect.uStartY = 0;//rect->uTop; dec_par.src_rect.uWidth = 720;//rect->uWidth; dec_par.src_rect.uHeight = 576;//rect->uHeight; imagedec_set_mode(id, IMAGEDEC_FULL_SRN, &dec_par); Imagedec_Osd_Io_Cmd cmd; MEMSET((void *)&cmd,0,sizeof(Imagedec_Osd_Io_Cmd)); cmd.on = 1; cmd.bitmap_start = (UINT8 *)((__MM_IMAGEDEC_BUF_ADDR+0x64600)& ~(3<<29)); //__MM_IMG_BITMAP_ADDR; cmd.bitmap_size = 0x2A300; //0x2A300= 320*240*2 //__MM_IMG_BITMAP_LEN; //for testing, remember to delete the malloc size // cmd.bitmap_start = (UINT8 *)(MALLOC(0x2A300)); // cmd.bitmap_size = 0x2A300; //0x2A300= 320*240*2 //__MM_IMG_BITMAP_LEN; cmd.dis_rect.uStartX = rect->uLeft; cmd.dis_rect.uStartY = rect->uTop;//0; cmd.dis_rect.uWidth = rect->uWidth; cmd.dis_rect.uHeight = rect->uHeight; imagedec_ioctl(id, IMAGEDEC_IO_CMD_OSD_SHOW, (UINT32)&cmd); img_input_pos = 0; ret = imagedec_decode(id, file_handle); if(ret!=TRUE) AD_IMG_PRINTF("\n Decode Image Unsuccessfully"); if(imagedec_stop(id)!=TRUE) AD_IMG_PRINTF("\n Stop Image decoding unsuccessfully!\n"); if(imagedec_release(id)!=TRUE) AD_IMG_PRINTF("\n Release Image decoder unsuccessfully!\n"); }