Skip to main content
arnold
Associate III
August 4, 2012
Question

searching for TJpgDec example code

  • August 4, 2012
  • 20 replies
  • 4460 views
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 
    This topic has been closed for replies.

    20 replies

    zaurozavr
    Visitor II
    August 11, 2012
    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
    arnoldAuthor
    Associate III
    August 12, 2012
    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
    arnoldAuthor
    Associate III
    August 14, 2012
    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
    Visitor II
    August 14, 2012
    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
    arnoldAuthor
    Associate III
    August 17, 2012
    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
    Visitor II
    August 17, 2012
    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
    arnoldAuthor
    Associate III
    August 17, 2012
    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
    arnoldAuthor
    Associate III
    August 18, 2012
    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
    arnoldAuthor
    Associate III
    August 21, 2012
    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.
    aambreen
    Associate
    October 31, 2012
    Posted on October 31, 2012 at 05:46

    @geurtse

    Can you please share the fatfs part of your code? I badly need it working....My code isn't creating a file..It initializes the card successfully as well as f_mount returns OK....but all other functions of FATFS returns error

    Please help me out in fixing the problem