void jpeg_drv_dec_set_bs_info(unsigned int bsBase, unsigned int bsSize) { CHECK_ALIGN(bsBase, 16, (kal_uint32) REG_ADDR_JPGDEC_FILE_ADDR); CHECK_ALIGN(bsSize, 128, (kal_uint32) REG_ADDR_JPGDEC_FILE_TOTAL_SIZE); IMG_REG_WRITE((bsBase), REG_ADDR_JPGDEC_FILE_ADDR); IMG_REG_WRITE((bsSize), REG_ADDR_JPGDEC_FILE_TOTAL_SIZE); }
void jpeg_drv_dec_set_bs_writePtr(unsigned int writePtr) { CHECK_ALIGN(writePtr, 16, (kal_uint32) REG_ADDR_JPGDEC_FILE_BRP); IMG_REG_WRITE((writePtr), REG_ADDR_JPGDEC_FILE_BRP); }
static UINT find_smallest_hole(UINT size, UCHAR page_align, heap *aheap) //Binary search? { UINT i, location; mm_header *entry; int offset; for (i = 0; i < aheap->entrycount; i++) { entry = aheap->entries[i]; if (page_align) { location = (UINT)entry; offset = 0; if (CHECK_ALIGN(location + sizeof(mm_header))) offset = FRAME_SIZE - (location + sizeof(mm_header)) % FRAME_SIZE; if ((int)entry->size - offset >= (int)size) return i; } else if (entry->size >= size) return i; } return MM_NO_HOLE; }
SINT32 gp2dScale( spBitmap_t *pdstBitmap, spRect_t dstRect, spBitmap_t *psrcBitmap, spRect_t srcRect ) { scale_content_t sct; g2d_draw_ctx_t drawCtx; SINT32 handle = -1; SINT32 ret = SP_OK; /*!<scaling with scalar must need the follow conditions 1.size is not smaller than 16X16; 2.addr and pitch must 4 byte aligned if not use 2D to scale*/ if (CHECK_ALIGN(pdstBitmap->pData + dstRect.x * getBpp(pdstBitmap->type)) && (CHECK_ALIGN(dstRect.width * getBpp(pdstBitmap->type))) && (CHECK_ALIGN(psrcBitmap->pData + srcRect.x * getBpp(psrcBitmap->type))) && (CHECK_ALIGN(srcRect.width * getBpp(psrcBitmap->type))) && (CHECK_SIZE(dstRect.width)) && (CHECK_SIZE(dstRect.height)) && (CHECK_SIZE(srcRect.width)) && (CHECK_SIZE(srcRect.height))) /*if (0)*/{ /*!<use scalar to scale*/ //diagLog(DIAG_LVL_INFO, "Use /dev/scalar to do scale...\n"); handle = open("/dev/scalar", O_RDONLY); if (handle < 0) { diagLog(DIAG_LVL_ERROR, "open scale dev fail!\n"); return SP_FAIL; } memset(&sct, 0, sizeof(sct)); memcpy(&sct.dst_img, pdstBitmap, sizeof(spBitmap_t)); memcpy(&sct.scale_rgn, &dstRect, sizeof(spRect_t)); memcpy(&sct.src_img, psrcBitmap, sizeof(spBitmap_t)); memcpy(&sct.clip_rgn, &srcRect, sizeof(spRect_t)); if ((ret = ioctl(handle, SCALE_IOCTL_TRIGGER, &sct)) < 0) { diagLog(DIAG_LVL_ERROR, "do scale error occur!\n"); ret = SP_FAIL; goto _resourceCollection; } } else { /*!<use 2D to scale*/ //diagLog(DIAG_LVL_INFO, "Use /dev/graphic to do scale...\n"); handle = open(G2D_DEV_NAME, O_RDWR); if (handle < 0) { diagLog(DIAG_LVL_ERROR, "[%s:%s:%d] [%s] open fail!\n", __FILE__, __FUNCTION__, __LINE__, G2D_DEV_NAME); return SP_FAIL; } memset(&drawCtx, 0, sizeof(g2d_draw_ctx_t)); memcpy(&drawCtx.dst, pdstBitmap, sizeof(spBitmap_t)); memcpy(&drawCtx.dst_rect, &dstRect, sizeof(spRect_t)); memcpy(&drawCtx.src, psrcBitmap, sizeof(spBitmap_t)); memcpy(&drawCtx.src_rect, &srcRect, sizeof(spRect_t)); drawCtx.func_flag = G2D_FUNC_ROP | G2D_FUNC_SCALE; drawCtx.rop.fg_rop = G2D_ROP_SRCCOPY; ret = ioctl(handle, G2D_IOCTL_DRAW_BITMAP, &drawCtx); if (ret < 0) { diagLog(DIAG_LVL_ERROR, "[%s:%d]G2D_IOCTL_DRAW_BITMAP, errcode = 0x%x\n", __FUNCTION__, __LINE__, ret); ret = SP_FAIL; goto _resourceCollection; } } _resourceCollection: if (handle >= 0) { close(handle); } return ret; }