cancel
Showing results for 
Search instead for 
Did you mean: 

searching for TJpgDec example code

arnold
Associate II
Posted on August 04, 2012 at 15:52

hello 

as the tittle says i'm searching for some example code for

http://elm-chan.org/fsw/tjpgd/00index.html

i have fatfs working from chan. i have a display up and running. 

now i only need to find out how to use the above decoder. 

could someone help me. 

thanks 
20 REPLIES 20
arnold
Associate II
Posted on August 11, 2012 at 08:35

could you provide me the link from libjpg, i searched it but couldnot find it.

zaurozavr
Associate II
Posted on August 11, 2012 at 13:08

Main ijg (libjpeg developer) site:

http://www.ijg.org/

STM32 firmware:

http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32f2-f4_demobuild.zip

Have you successed in TJPGD porting yet?

Here is a short video how does FatFs_Tdjpg_Demo project look like. Jpeg files from Windows sample library are halved in size (512x384  due to LCD small resolution):

http://www.zaurosoft.com/videos/ZP_DSF4/STM32F4Discovery_runs_TJPGD_demo.mp4

arnold
Associate II
Posted on August 12, 2012 at 09:40

Well i'm currently on holliday, so i have less time to try porting it. 

i hope next week to get some time to try it out. 

arnold
Associate II
Posted on August 14, 2012 at 10:02

i had some spare time, and have altered my project with part's of your code. 

but now when invoke the maloc, i get this error 

Heap and stack collision

is there a way to get ride of this error. i looked at stm32_flash.ld but i realy don't know what and where to alter these things. 

by the way i have a stm32f4 discovery, without external memory. 

the display i have is 320x240, so i need  

153 6

00

bytes to allocate and later in the code i need to allocate 4096 bytes.

zaurozavr
Associate II
Posted on August 14, 2012 at 10:31

You can't allocate 153600 bytes without an external RAM so keep ld script as is.

Instead of writing a whole image to the memory buffer  try to send it  to your LCD by line x MCU height blocks (or, simplier but slower) by  MCU line or MCU block (as you did in your version). All you need is just to change out_func. You are free to change  IODEV structure, f.e. adding extra data to amend out_func behavior, or write a pair of out_funcs to implement some different strategies.

   
arnold
Associate II
Posted on August 17, 2012 at 16:22

I don't get a image on my screen. 

when i debug it i have a  JDR_MEM1, /* 3: Insufficient memory pool for the image */

the pool size is 4096, do i have to increase it ?

or is there somthing else wrong ?

zaurozavr
Associate II
Posted on August 17, 2012 at 17:52

I gave you the working project. Have you read or compiled it? I did not use an external RAM at that time.

In my project do not change anything (except your FATFS realization and a bwa correction in the out_func as mentioned above) and in the main function add the breakpoint at f_lseek(), i.e

if

(

JDR_OK

== jd_prepare(&jdec, in_func, work, work_size, &dev) &&

(

JDR_OK

== jd_decomp(&jdec, out_func, scale)))

{

// Output decoded 96*64 16bpp image to your LCD here

// or just check the

fb

bitmap content

f_lseek(&fsrc,0);

//set breakpoint here

}

You should see now the 96x64 image on your LCD or as a bitmap while debugging  memory (fb content).

Try  to get them at first.

Then just correct the out_func for your needs. 

arnold
Associate II
Posted on August 17, 2012 at 19:09

i tryed, but i have a test version of attollic and this has a code limitation. 

normaly i use eclips, but eclips won't import the settings. 

i copy parts of your main file that i need to use, i used my own display driver and fatfs.

now i need to alter some things to get it to work.

i go try some more things.

 

arnold
Associate II
Posted on August 18, 2012 at 10:10

i found what was wrong, sometime ago i tryed alter the buffers even so JD_SZBUF

this buffer was set the same as the workspace, so i run out of memory, it is set back to 512

next thing to do is to write it to the display, i tryed LCD_WriteBMP(0,0,LCD_W,LCD_H, (uint16_t*)fb);

but that isn't working. 

i have to find out how to write it now. 

arnold
Associate II
Posted on August 21, 2012 at 21:51

I have a new problem, my program won't start. 

see [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/program won't startup. strainge jump to&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx&currentviews=0]Link

when i have solved the above problem, i get back to let you know if it is running.