Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: GR-PEACH_video GraphicsFramework R_BSP SDFileSystem_tmp mbed-rtos mbed
Diff: main.cpp
- Revision:
- 4:1a08ad86d9af
- Parent:
- 3:8489fb71f53d
- Child:
- 5:a429cac419e9
--- a/main.cpp Wed May 25 03:15:58 2016 +0000 +++ b/main.cpp Wed May 25 05:28:50 2016 +0000 @@ -40,7 +40,7 @@ #define FILE_NAME_LEN (64) #define TEXT_SIZE (64 + 1) //null-terminated #define FLD_PATH "/sd/" -#define MAX_JPEG_SIZE (1024 * 300) +#define MAX_JPEG_SIZE (1024 * 450) /* LCD Parameter */ #define LCD_INPUT_CLOCK (66.67f) @@ -100,12 +100,12 @@ static uint8_t user_frame_buffer[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]; static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]; #pragma data_alignment=8 -static uint8_t JpegBuffer[2][MAX_JPEG_SIZE]; //8 bytes aligned!; +static uint8_t JpegBuffer[MAX_JPEG_SIZE]@ ".mirrorram"; //8 bytes aligned!; #pragma data_alignment=4 #else static uint8_t user_frame_buffer[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32))); /* 32 bytes aligned */ static uint8_t user_frame_buffer2[FRAME_BUFFER_STRIDE * LCD_PIXEL_HEIGHT]__attribute((aligned(32))); /* 32 bytes aligned */ -static uint8_t JpegBuffer[2][MAX_JPEG_SIZE]__attribute((section("NC_BSS"),aligned(8))); //8 bytes aligned!; +static uint8_t JpegBuffer[MAX_JPEG_SIZE]__attribute((section("NC_BSS"),aligned(8))); //8 bytes aligned!; #endif static frame_buffer_t frame_buffer_info; static volatile int32_t vsync_count = 0; @@ -297,6 +297,10 @@ bool first_view = true; size_t ret; Timer t; + uint8_t * p_JpegBuffer[2]; + + p_JpegBuffer[0] = JpegBuffer; + p_JpegBuffer[1] = new uint8_t[MAX_JPEG_SIZE]; while (1) { // file search @@ -311,7 +315,7 @@ strcpy(file_path, FLD_PATH); strcat(file_path, p->d_name); fp = fopen(file_path, "r"); - ret = fread(&JpegBuffer[jpeg_toggle], sizeof(char), MAX_JPEG_SIZE, fp); + ret = fread(p_JpegBuffer[jpeg_toggle], sizeof(char), MAX_JPEG_SIZE, fp); fclose(fp); if (ret < MAX_JPEG_SIZE) { if (first_view != false) { @@ -319,7 +323,7 @@ t.start(); // Effect NONE first_view = false; - draw_image(&frame_buffer_info, (const graphics_image_t*)&JpegBuffer[jpeg_toggle]); + draw_image(&frame_buffer_info, (const graphics_image_t*)p_JpegBuffer[jpeg_toggle]); } else { bool key_press = false; t.stop(); @@ -337,16 +341,16 @@ // Effect DISSOLVE for (int i = 1; i <= DISSOLVE_STEP_NUM; i++) { draw_image_dissolve(&frame_buffer_info, - (const graphics_image_t*)&JpegBuffer[!jpeg_toggle], - (const graphics_image_t*)&JpegBuffer[jpeg_toggle], + (const graphics_image_t*)p_JpegBuffer[!jpeg_toggle], + (const graphics_image_t*)p_JpegBuffer[jpeg_toggle], (float32_t)i / (float32_t)DISSOLVE_STEP_NUM); } } else { // Effect SCROLL for (int i = 1; i <= SCROLL_STEP_NUM; i++) { draw_image_scroll(&frame_buffer_info, - (const graphics_image_t*)&JpegBuffer[!jpeg_toggle], - (const graphics_image_t*)&JpegBuffer[jpeg_toggle], + (const graphics_image_t*)p_JpegBuffer[!jpeg_toggle], + (const graphics_image_t*)p_JpegBuffer[jpeg_toggle], (float32_t)i / (float32_t)SCROLL_STEP_NUM); } }