bmp.c
上传用户:jncsjc
上传日期:2022-03-24
资源大小:1k
文件大小:3k
- #include <string.h>
- #include "bmp.h"
- #include "reg_def.h"
- #include "jpeg.h"
- #include "cache.h"
- #include "gpu.h"
- #include "cfg_mem.h"
- #include "menu_graph.h"
- #include "gpu.h"
- #include "file.h"
- #include "fat.h"
- #include "lut_setting.h"
- extern HR_U32 cur_jpg_index ;
- extern __u32 cur_jpg_file;
- void rgb2yuv(__u8 *srcAddr, __u8 *dstAddrY,__u8 *dstAddrU,__u8 *dstAddrV,__u32 size)
- {
- long count,i;
- __u8 y, cb, cr;
- __u8 red, green, blue;
- for(count= 0;count<size/3L/OSD_W_MAX;count++){
- for(i = 0;i < OSD_W_MAX;i++){
- blue = *srcAddr;
- srcAddr = (long)srcAddr+1L;
- green = *srcAddr;
- srcAddr = (long)srcAddr+1L;
- red = *srcAddr;
- srcAddr = (long)srcAddr+1L;
-
- y = (16 + ( ((257*(__u32)red)/1000) + ((504*(__u32)green)/1000) + ((98 *(__u32)blue)/1000)));
- cb = (128 + (-((148*(__u32)red)/1000) - ((291*(__u32)green)/1000) + ((439*(__u32)blue)/1000)));
- cr = (128 + ( ((439*(__u32)red)/1000) - ((368*(__u32)green)/1000) - ((71 *(__u32)blue)/1000)));
-
- *dstAddrY = y;
- *dstAddrU = cb;
- *dstAddrV = cr;
- dstAddrY = (long)dstAddrY+1L;
- dstAddrU = (long)dstAddrU+1L;
- dstAddrV = (long)dstAddrV+1L;
- }
- dstAddrY = (long)dstAddrY-OSD_W_MAX*2L;
- dstAddrU = (long)dstAddrU-OSD_W_MAX*2L;
- dstAddrV = (long)dstAddrV-OSD_W_MAX*2L;
- }
- }
- #include "jpg_player.h"
- extern gui_component_t const far gc_logo[GUI_NB];
- __u8 deal_bmp(void)//int x, int y, int win_w, int win_h, __u8 mode
- {
- hi_file *bmp_file = &cur_jpg_file;
- char bmp_file_flag;
- __u32 readsize;
- __u32 i;
- __u32 bmp_width,bmp_height;
- #define BMP_SHOW_ADDR OSD_ADDR_0_TEMP
- gui_component_t *gc = gui_get_cur_component(gc_logo );
- destroy_osd1();
- destroy_osd2();
- destroy_osd3();
- destroy_osd4();
- create_osd0((void far *)BMP_SHOW_ADDR,0,0,OSD_W_MAX,OSD_H_MAX);
- HRJPEG_Enable();
- HRJPEG_Reset();
- test_osd0((void far *)BMP_SHOW_ADDR,0,0,OSD_W_MAX,OSD_H_MAX);
- memcpy((void far *)JPEG_SDRAM_ADDR,gc->dat,gc->size);
- wr_lut(0,0);
- flush_cache();
- HRJpeg_ShowNoScaler((void far *)JPEG_SDRAM_ADDR,0,0);
- HRJPEG_Disable();
- show_osd0();
- bmp_width = 800;
- bmp_height = 600;
- bmp_file_flag=file_open(get_file_item(cur_jpg_file,FILEITEM_INDEX), bmp_file); //cur_jpg_index
- file_setposition(bmp_file, 0x36);
- readsize = (__u32)bmp_width*BmpStep*3L;
- for(i = 0;i<bmp_height-bmp_height%BmpStep;i+=BmpStep){
- file_read(bmp_file, (__u8 far *)BMP_DATA_SDRAM_ADDR, readsize);
- rgb2yuv((__u8 far *)BMP_DATA_SDRAM_ADDR,
- (__u8 far *)(BMP_SHOW_ADDR+(OSD_H_MAX-i-1L)*OSD_W_MAX),
- (__u8 far *)(BMP_SHOW_ADDR+((OSD_H_MAX<<1)-i-1L)*OSD_W_MAX),
- (__u8 far *)(BMP_SHOW_ADDR+(OSD_H_MAX*3L-i-1L)*OSD_W_MAX),
- readsize);
- }
- if(bmp_height%BmpStep){
- readsize = bmp_width*(bmp_height%BmpStep)*3L;
- file_read(bmp_file, (__u8 far *)BMP_DATA_SDRAM_ADDR, readsize);
- rgb2yuv(BMP_DATA_SDRAM_ADDR,
- BMP_SHOW_ADDR+(bmp_height%BmpStep)*OSD_W_MAX-OSD_W_MAX,
- BMP_SHOW_ADDR+(bmp_height%BmpStep)*OSD_W_MAX+OSD_W_MAX*OSD_H_MAX-OSD_W_MAX,
- BMP_SHOW_ADDR+(bmp_height%BmpStep)*OSD_W_MAX+OSD_W_MAX*OSD_H_MAX*2L-OSD_W_MAX,
- readsize);
- }
- }