static int do_bmp_scale(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { #ifndef CONFIG_OSD_SCALE_ENABLE ulong src_addr, dst_addr; unsigned width, height; switch (argc) { case 3: src_addr = simple_strtoul(argv[1], NULL, 16); dst_addr = simple_strtoul(argv[2], NULL, 16); width = simple_strtoul(getenv("display_width"), NULL, 0); height = simple_strtoul(getenv("display_height"), NULL, 0); printf("src_addr=0x%x,dst_addr=0x%x,w=%d,h=%d\n", (uint)src_addr, (uint)dst_addr, width, height); break; default: return cmd_usage(cmdtp); break; } return (bmp_scale(src_addr, dst_addr, width, height)); #else return (bmp_scale()); #endif }
int logo_display(void) { int ret = 0; char buf[32]; printf("logo_display: \n"); run_command ("osd enable", 0); sprintf(buf, "osd open 24 %d %d 1", osd_width, osd_height); printf("buf=%s.\n", buf); run_command (buf, 0); run_command ("osd fill 0", 0); run_command ("tv open ${outputmode}", 0); // run_command ("nand read ${loadaddr} ${aml_logo_start} ${aml_logo_size}", 0); // run_command ("nand read ${aml_logo_name} ${loadaddr} 0 ${aml_logo_size}", 0); // ret = run_command ("bmp display ${loadaddr}", 0); run_command ("nand read ${aml_logo_name} 82000000 0 ${aml_logo_size}", 0); bmp_scale(0x82000000, 0x84100000, osd_width, osd_height); ret = run_command ("bmp display 84100000", 0); // run_command ("lcd bl on", 0); #ifdef M3_DSP_VSYNC_INTERRUPT ret = run_command ("tvdsp check;tvdsp stop", 0); #endif return ret; }
int main(int argc, char **argv) { bmpfile_t *bmp_resized = NULL; bmpfile_t *result = NULL; int width, height,num_threads, i, j; float scale; // Parse argv. scale = (float)atof(argv[2]); num_threads = atoi(argv[3]); omp_set_num_threads(num_threads); bmp_resized = bmp_scale( argv[1], scale, num_threads); width = bmp_get_dib(bmp_resized).width; height = bmp_get_dib(bmp_resized).height; result = bmp_create(width, height, 8); if( result != NULL){ //printf(" about to make new file!\n"); //#pragma omp parallel for private(j) for (i = 0; i < width; ++i) { for (j = 0; j < height; ++j) { int num = omp_get_thread_num(); //printf("Thread %i has i = %i and j = %i\n", num, i, j); rgb_pixel_t *p = bmp_get_pixel(bmp_resized, i, j); bmp_set_pixel(result, i, j, *p); } } //printf("made new file!\n"); bmp_save(result, "bmp_scale.bmp"); } //printf("finished saving!\n"); bmp_destroy(bmp_resized); return 0; }
int logo_display(void) { int ret = 0; int i; char *p_outputmode=NULL; char *screen_width, *screen_height; char *output_width ,*output_height; char *default_w, *default_h; int need_set_screen=0; char width[10],height[10]; char *outputmode[7]={"480i","480p","576i","576p","720p","1080i","1080p"}; #if 1 //Use scale // ret = run_command ("nand read ${loadlogoaddr} ${aml_logo_start} ${aml_logo_size}", 0); ret = run_command ("nand read ${aml_logo_name} ${loadlogoaddr} 0 ${aml_logo_size}",0); if(((screen_width = getenv("screen_width")) == NULL) || ((screen_height = getenv("screen_height")) == NULL)) need_set_screen = 1; if((p_outputmode = getenv ("outputmode")) != NULL) { for(i=0 ;i<7;i++) { if(!strcmp(p_outputmode,outputmode[i])) { printf("i =%d\n",i); printf("outputmode = %s\n",p_outputmode); break; } } switch(i) { case 0: output_width = getenv("480ioutputwidth"); output_height = getenv("480ioutputheight"); default_w = "720"; default_h = "480"; bmp_scale(0x84100000, 0x84900000, 720, 480); run_command ("tv open 480I", 0); run_command ("osd open 24 720 480 1", 0); break; case 1: output_width = getenv("480poutputwidth"); output_height = getenv("480poutputheight"); default_w = "720"; default_h = "480"; bmp_scale(0x84100000, 0x84900000, 720, 480); run_command ("osd open 24 720 480 1", 0); run_command ("tv open 480P", 0); break; case 2: output_width = getenv("576ioutputwidth"); output_height = getenv("576ioutputheight"); default_w = "720"; default_h = "576"; bmp_scale(0x84100000, 0x84900000, 720, 576); run_command ("tv open 576I", 0); run_command ("osd open 24 720 576 1", 0); break; case 3: output_width = getenv("576poutputwidth"); output_height = getenv("576poutputheight"); default_w = "720"; default_h = "576"; bmp_scale(0x84100000, 0x84900000, 720, 576); run_command ("osd open 24 720 576 1", 0); run_command ("tv open 576P", 0); break; case 4: output_width = getenv("720poutputwidth"); output_height = getenv("720poutputheight"); default_w = "1280"; default_h = "720"; bmp_scale(0x84100000, 0x84900000, 1280, 720); run_command ("osd open 24 1280 720 1", 0); run_command ("tv open 720P", 0); break; case 5: output_width = getenv("1080ioutputwidth"); output_height = getenv("1080ioutputheight"); default_w = "1920"; default_h = "1080"; bmp_scale(0x84100000, 0x84900000, 1920, 1080); run_command ("tv open 1080I", 0); run_command ("osd open 24 1920 1080 1", 0); break; case 6: output_width = getenv("1080poutputwidth"); output_height = getenv("1080poutputheight"); default_w = "1920"; default_h = "1080"; bmp_scale(0x84100000, 0x84900000, 1920, 1080); run_command ("osd open 24 1920 1080 1", 0); run_command ("tv open 1080P", 0); break; default: output_width = getenv("480poutputwidth"); output_height = getenv("480poutputheight"); bmp_scale(0x84100000, 0x84900000, 720, 480); run_command ("osd open 24 720 480 1", 0); run_command ("tv open 480P", 0); break; } ret = run_command ("bmp display 84900000 0 0", 0); if((output_width != NULL) && (output_height != NULL)) { printf("output_width =%s,output_height=%s\n",output_width,output_height); if((need_set_screen) || ((strcmp(screen_width,output_width) || strcmp(screen_height,output_height)))) { strcpy(width,output_width); strcpy(height,output_height); setenv("screen_width",width); setenv("screen_height",height); // printf("width =%s,height=%s\n",width,height); } }else { printf("not set screen size yet\n"); setenv("screen_width",default_w); setenv("screen_height",default_h); } }else { printf("No outputmode env parameter. Use default 480p mode!\n"); // run_command ("nand read ${loadlogoaddr} ${aml_logo_start} ${aml_logo_size}", 0); run_command ("nand read ${aml_logo_name} ${loadlogoaddr} 0 ${aml_logo_size}",0); run_command ("osd open 24 720 480 1", 0); run_command ("tv open 480P", 0); ret = run_command ("bmp display ${loadlogoaddr} 0 0", 0); } return ret; #else//Use multi logo. Note: It need add i mode and 576 i p mode. if((p_outputmode = getenv ("outputmode")) != NULL) { if(!strcmp(p_outputmode,"720p")) { printf("Use 720p mode!\n"); // run_command ("nand read ${loadlogoaddr} ${aml_logo_start_720p} ${aml_logo_size}", 0); run_command ("nand read ${aml_logo_name} ${loadlogoaddr} 0 ${aml_logo_size}",0); run_command ("osd open 24 1280 720 1", 0); run_command ("tv open 720P", 0); } else if(!strcmp(p_outputmode,"1080p")) { printf("Use 1080p mode!\n"); //run_command ("nand read ${loadlogoaddr} ${aml_logo_start_1080p} ${aml_logo_size}", 0); run_command ("nand read ${aml_logo_name} ${loadlogoaddr} 0 ${aml_logo_size}",0); run_command ("osd open 24 1920 1080 1", 0); run_command ("tv open 1080P", 0); } else//default 480p { printf("Use default 480p mode!\n"); //run_command ("nand read ${loadlogoaddr} ${aml_logo_start} ${aml_logo_size}", 0); run_command ("nand read ${aml_logo_name} ${loadlogoaddr} 0 ${aml_logo_size}",0); run_command ("osd open 24 720 480 1", 0); run_command ("tv open 480P", 0); } ret = run_command ("bmp display ${loadlogoaddr} 0 0", 0); return ret; } else { printf("No outputmode env parameter. Use default 480p mode!\n"); //run_command ("nand read ${loadlogoaddr} ${aml_logo_start} ${aml_logo_size}", 0); run_command ("nand read ${aml_logo_name} ${loadlogoaddr} 0 ${aml_logo_size}",0); run_command ("osd open 24 720 480 1", 0); run_command ("tv open 480P", 0); ret = run_command ("bmp display ${loadlogoaddr} 0 0", 0); return ret; } #endif }